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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The application contains a main() method that takes one parameter: a Stringrepresenting the user whose status we are interested in. The main() methodinstantiates a new UserStatus object and calls its getUserStatus() method(Example 4-3), passing in the String parameter. The getuserStatus() methodreturns a Java short object representing the user’s status:► 32: User is online and active.► 96: User is online but away.► 128: User is online but in ‘Do not disturb’ status.► 0: User is offline.Note: You can find all of the official Sametime status in the Javadoc referencein the STUserStatus class description.Example 4-3 UserStatus main() methodpublic static void main(String[] args){if(args.length != 1){System.out.println("Usage: UserStatus userToFind");System.exit(0);}}short shUserStatus = new UserStatus().getUserStatus(args[0]);System.out.println("Status for user " + args[0] + ": " + shUserStatus);The getUserStatus() method (Example 4-4 on page 89) creates a new Sametimesession object and loads the required components into it. It then starts thesession.Attention: For a more detailed discussion of this process, see 3.2.1, “Creatinga Sametime session” on page 52.The method gets references to both the CommunityService and LookupServicecomponents before attempting to log in to the Sametime server. It waits until ithas successfully logged in to the server and set up the Sametime objects itneeds or until it exceeds its maximum number of setup attempts. If the setupcompletes successfully, the resolve() method is called and finally the value of them_shUserStatus variable is returned. This value gives the current status for therequested user.88 <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!