10.07.2015 Views

Lotus Instant Messaging/ Web Conferencing ... - IBM Redbooks

Lotus Instant Messaging/ Web Conferencing ... - IBM Redbooks

Lotus Instant Messaging/ Web Conferencing ... - IBM Redbooks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Example 8-7 Establishing a Sametime sessionpublic RedPanelDiscussionSA(String host) {try{m_session = new STSession("Red Panel Discussion SA" + this);String [] compNames = { ServerAppService.COMP_NAME,ActivityService.COMP_NAME,PlacesAdminService.COMP_NAME };m_session.loadComponents( compNames );m_session.start();}catch(DuplicateObjectException e){e.printStackTrace();exit();}}// .... code removedOnce the session is started, we add a PlacesAdminServiceListener and aActivityServiceListener so we will receive events from the PlaceAdminServiceand the ActivityService, both of which will be discussed later in this chapter.Next, we use the code in Example 8-8 to log into the Sametime server as aserver application.Example 8-8 Logging in as a server applicationvoid login(String host){m_saService =(ServerAppService)m_session.getCompApi(ServerAppService.COMP_NAME);short loginType = STUserInstance.LT_SERVER_APP;int[] supportedServices = {RedPanelDiscussionConstants.ACTIVITY_TYPE };// Server applications login directly to the server, and not through// the mux. So we can't use the default port.Connection[] connections = {new SocketConnection(1516, 17000), };m_saService.setConnectivity(connections);m_saService.addLoginListener(this);204 <strong>Lotus</strong> <strong>Instant</strong> <strong>Messaging</strong>/<strong>Web</strong> <strong>Conferencing</strong> (Sametime): Building Sametime-Enabled Applications

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!