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 3-11 loggedOut() methodpublic void loggedOut(LoginEvent event){if (m_session.isActive()){destroy();}while (!m_session.isActive()){try {Thread.sleep(5000);login();}catch (Exception e) {}}}/**Clean up resources*/public void destroy(){m_communityService.logout();m_communityService.removeLoginListener(this);m_imService.removeImServiceListener(this);m_session.stop();m_session.unloadSession(); }FAQBotThis class is application-specific; it extends the SametimeBot abstract class andimplements the logic specific to an FAQ Bot. In this case, it searches a Dominodatabase for answers to questions posed by end users. It makes a note, bycreating a new document, of any questions it does not already know the answerto, so the database can be expanded.As our back-end data source is a Domino database and we will be accessing itusing the Java API, we need to import the lotus.domino package (seeExample 3-12).Example 3-12 FAQBot package imports and class definitionimport java.util.*;import lotus.domino.*;import com.lotus.sametime.im.*;public class FAQBot66 <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!