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.

}}private boolean isLoggedIn(){if(m_communityService == null){return false;}return m_communityService.isLoggedIn();}Attention: For a more detailed discussion of the login process, see 3.2.2,“Logging in to the community” on page 53.The loggedIn() method (Example 4-6) is called upon successful login to theSametime server. The application creates a Resolver object from theLookupService component. It uses the Resolver to resolve the String user nameprovided as a parameter to the application into a Sametime STUser object. Theapplication also creates a WatchList object from the AwarenessServicecomponent. It adds itself as StatusListener to the WatchList object so it canreceive events whenever the status of the watched user changes. The booleanm_bSetup is then changed so the getUserStatus() method can continue.Example 4-6 UserStatus loggedIn() methodpublic void loggedIn(LoginEvent event){System.out.println("loggedIn()");m_resolver = m_lookupService.createResolver(false, false, true, false);m_awarenessService = (AwarenessService)m_session.getCompApi(AwarenessService.COMP_NAME);m_watchList = m_awarenessService.createWatchList();m_watchList.addStatusListener(this);m_bSetup = true;}Once the m_bSetup flag is switched, the resolve() method (Example 4-7 onpage 92) is called. The application adds itself as a ResolveListener to theResolver object. It then calls the resolve() method of the Resolver object, passingit the user name of the user we are interested in. The application waits to benotified on the success of the resolve process. It does this by receiving one of thethree events defined in the ResolveListener interface. Upon completion, theapplication removes itself as a ResolveListener. It then waits on confirmation thatthe requested user’s status has been obtained. Once it receives thisconfirmation, it removes itself as a StatusListener from, and then closes, theChapter 4. <strong>Web</strong> services 91

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

Saved successfully!

Ooh no, something went wrong!