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.

import com.lotus.sametime.core.types.*;import com.lotus.sametime.lookup.*;The class implements three Sametime listener interfaces: LoginListener,ResolveListener, and StatusListener.The LoginListener interface allows the application to receive LoginEvent events,of which there are two: loggedIn() and loggedOut(). The application is notified bythe Community Service when the login process has finished by calling one ofthese two methods.The ResolveListener interface allows the application to receive ResolveEventevents that are fired by the Lookup Service in response to requests to resolveuser names as Sametime objects. The ResolveListener interface implementsthree methods: resolved(), resolveConflict(), and resolveFailed(). If the username is successfully resolved with only one match in the directory, the resolved()method is called and we can get a handle on the Sametime STUser object forthat user.The StatusListener interface implements two methods: groupCleared() anduserStatusChanged(), and allows the application to receive StatusEvent eventsabout the STUser object resolved by the Lookup Service, from which its currentstatus can be derived.The UserStatus class defines a number of variables for the Sametime objects ituses, the name of the user to search for and their status, and some booleans tohandle event timing (see Example 4-2 for more details).Example 4-2 Interfaces implemented by UserStatus class and variable declarationspublic class UserStatus implements LoginListener, ResolveListener,StatusListener{private STSession m_session;private CommunityService m_communityService;private LookupService m_lookupService;private AwarenessService m_awarenessService;private Resolver m_resolver;private WatchList m_watchList;private STUser m_requestedUser;private String m_strUserName;private short m_shUserStatus;private boolean m_bSetup;private boolean m_bResolved;private boolean m_bFinished;Chapter 4. <strong>Web</strong> services 87

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

Saved successfully!

Ooh no, something went wrong!