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.

ActivityHandlerPlaceMonitorActivityPlaceLobbyMonitorQueueMonitornew PlaceMonitor(Place)addPlaceListener(this)addIncomingMessageListener(this)sectionAdded(PlaceEvent)addSectionListener(SectionListener)addSectionListener(SectionListener)Figure 8-7 Process for setting up Place and section monitors8.5.5 Managing the QueueThe QueueMonitor class is responsible for monitoring users entering and leavingthe Queue section. When a user enters the Queue section, we perform somehousekeeping chores. We store their UserInPlace object in a hashtable so thatwe have a means of communicating with the user when we need to. We then addtheir Member ID to a vector, which serves as the Queue for asking questions tothe panel. Users are added in a first-in-first-out basis. Finally, we add aUserInPlaceListener for the user. We needed to add this listener in order toaccess the users attributes; otherwise, we could not access them using theUserInPlace.getAttributes() method.When a user enters the Queue, the userEntered() event is fired. If the Queuevector is empty when a user enters the section, the user is given permission toask the panel a question. We use the UserInPlace.sendData() method to notifythe user that it is their turn. The user then has the right to speak until he isfinished. When finished, the user will clicks a button in the client application,which will move them back into the Lobby. When they leave the section, theuserLeft() event is triggered, which removes the user from the hashtable andQueue, removes the listener, and then notifies the next user.Example 8-10 on page 213 shows the code used to monitor users entered andleaving the Queue section.212 <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!