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.

}// end getTokenWhen the user is successfully resolved, SametimeToken’s resolved() method(see Example 12-15) is called. We cast the resolved object into an instance of anSTUser object, then pass it into the generateToken() method of theSATokenService object.Example 12-15 SametimeToken resolved() method// User is a valid Sametime user - generate a token for thempublic void resolved(ResolveEvent event){System.out.println("resolved");if (event.getName().toLowerCase().compareTo(m_strUserName.toLowerCase())== 0){STUser portalUser = (STUser)event.getResolved();// Use the token service to generate a token for this particular STUserobjectm_tokenService.generateToken(portalUser);}}For a successful token generation, SametimeToken’s tokenGenerated() method(Example 12-16) is called. We get a handle on the Token object by calling thegetToken() method of the TokenEvent object. We then check to make sure thatthe generated token is the one we have asked for by calling the getLoginName()method of the token object and comparing it with our user name. If the namesmatch, we return the text value of the token by calling the getTokenString()method of the token object.Example 12-16 SametimeToken tokenGenerated() method// return the token as a stringpublic void tokenGenerated(TokenEvent event){System.out.println("tokenGenerated");Token theToken = event.getToken();if(theToken.getLoginName().toLowerCase().compareTo(m_strUserName.toLowerCase())== 0){m_strUserToken = theToken.getTokenString();m_bFinished = true;}Chapter 12. Ideas for customization and integration 349

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

Saved successfully!

Ooh no, something went wrong!