com.floranta.client
Class CommunicatorPool

java.lang.Object
  |
  +--com.floranta.client.CommunicatorPool

public class CommunicatorPool
extends java.lang.Object

The communicator pool keeps track of clients wishing to collaborate over floranta, and pools communicators for different persistence types.

Author:
cscarlos

Constructor Summary
CommunicatorPool(java.lang.String server, java.lang.String location, java.lang.String identifier)
          Constructor taking the server url, client's location and client's unique identifier.
 
Method Summary
 void add(Message message, Persistence persistence)
          Add a message to a document with the persistence level
 void addListener(MessageListener listener, Persistence persistence, java.lang.String channel)
          Allows a listener to listen to messages of a given persistence and channel
 void dispose()
          Disposes of all resources.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommunicatorPool

public CommunicatorPool(java.lang.String server,
                        java.lang.String location,
                        java.lang.String identifier)
Constructor taking the server url, client's location and client's unique identifier.

Parameters:
server - The url of the server
location - The string representing the location of the client. All clients in the same location will be connected to one another
identifier - The unique identifier that identifies a client. Each browser page/frame chooses a GUID for itself.
Method Detail

addListener

public void addListener(MessageListener listener,
                        Persistence persistence,
                        java.lang.String channel)
Allows a listener to listen to messages of a given persistence and channel

Parameters:
listener - The client listening on messages
persistence - The persistence level of the messages
channel - The channel name to listen for messages on

add

public void add(Message message,
                Persistence persistence)
Add a message to a document with the persistence level

Parameters:
message - A message is the line to be added to the document
persistence - The duration for which the message should be kept

dispose

public void dispose()
Disposes of all resources. No methods should be called on the CommunicatorPool object after dispose has been called. A new CommunicatorPool can be obtained and initialized with the old identifier for uninterrupted communication.