net.user1.union.api
Interface Room

All Superinterfaces:
AttributeHolder, EventProducer, RemoteEventProducer

public interface Room
extends AttributeHolder, RemoteEventProducer

A room is a place for clients to engage in group communication. A client that joins a room is known as a room occupant.


Field Summary
static java.lang.String ATTR_CLUSTER_TYPE
           
static java.lang.String ATTR_DIE_ON_EMPTY
           
static java.lang.String ATTR_MAX_CLIENTS
           
static java.lang.String ATTR_MAX_UPDATE_LEVEL
           
static java.lang.String ATTR_PASSWORD
           
 
Method Summary
 boolean containsClient(Client client)
          Returns true if the client is in the room, false otherwise.
 boolean containsObserver(Client client)
          Returns true if the Client is an observer of the room, false otherwise.
 java.util.Set<Client> getClients()
          Returns a reference to all of clients in the room.
 ClusterRole getClusterRole()
          Returns the role, if any, that the room has within the cluster (eg.
 long getCreationTime()
          Retrieves the time the room was created.
 int getNumClients()
          Get the number of clients in the room.
 int getNumObservers()
          Get the number of observers spectating the room.
 java.lang.String getOwnerID()
          Return the client ID of the owner of the room.
 java.lang.String getQualifiedID()
          Returns the ID including the qualifier for the room.
 java.lang.String getSimpleID()
          Returns the Simple ID of the room.
 boolean isShutdown()
          Indicates if this room has been shutdown.
 void restart()
          Restarts the room with the original RoomDef.
 void sendMessage(Filter filter, java.lang.String message, java.lang.String... args)
          This generates a u7 which is sent to all clients in the room.
 void sendMessage(java.util.Set<Client> clients, java.lang.String message, java.lang.String... args)
          This generates a u7 which is sent to the clients in the list clients.
 void sendMessage(java.lang.String message, java.lang.String... args)
          This generates a u7 which is sent to all clients in the room.
 void shutdownRoom()
          Shuts down this room and removes it from the server.
 
Methods inherited from interface net.user1.union.core.attribute.AttributeHolder
getAttribute, getAttribute, getAttributes, getAttributes, getAttributesByScope, getAttributeValue, getAttributeValue, onChangeAttribute, onRemoveAttribute, removeAttribute, removeAttribute, setAttribute
 
Methods inherited from interface net.user1.union.core.event.RemoteEventProducer
addRemoteEventListener, dispatchRemoteEvent, dispatchRemoteEvent, getRemoteEventClassMap, removeRemoteEventListener
 
Methods inherited from interface net.user1.union.core.event.EventProducer
addEventListener, dispatchEvent, getEventClassMap, removeEventListener
 

Field Detail

ATTR_MAX_CLIENTS

static final java.lang.String ATTR_MAX_CLIENTS
See Also:
Constant Field Values

ATTR_DIE_ON_EMPTY

static final java.lang.String ATTR_DIE_ON_EMPTY
See Also:
Constant Field Values

ATTR_MAX_UPDATE_LEVEL

static final java.lang.String ATTR_MAX_UPDATE_LEVEL
See Also:
Constant Field Values

ATTR_PASSWORD

static final java.lang.String ATTR_PASSWORD
See Also:
Constant Field Values

ATTR_CLUSTER_TYPE

static final java.lang.String ATTR_CLUSTER_TYPE
See Also:
Constant Field Values
Method Detail

containsClient

boolean containsClient(Client client)
Returns true if the client is in the room, false otherwise.

Parameters:
client - the client
Returns:
true if the client is in the room, false otherwise

containsObserver

boolean containsObserver(Client client)
Returns true if the Client is an observer of the room, false otherwise.

Parameters:
client - the client
Returns:
true if the client is observing the room, false otherwise

getNumClients

int getNumClients()
Get the number of clients in the room. Only occupants are considered to be in the room. Observers do not count (use getNumObservers() to get the number of observers spectating the room).

Returns:
the number of clients in the room

getClients

java.util.Set<Client> getClients()
Returns a reference to all of clients in the room.

Returns:
a set of all clients in the room

getNumObservers

int getNumObservers()
Get the number of observers spectating the room.

Returns:
the number of observers spectating the room

sendMessage

void sendMessage(java.lang.String message,
                 java.lang.String... args)
This generates a u7 which is sent to all clients in the room. It is similar to when a u1 is sent by a client.

Parameters:
message - - the name of the message
args - - the args to be sent with the message

sendMessage

void sendMessage(Filter filter,
                 java.lang.String message,
                 java.lang.String... args)
This generates a u7 which is sent to all clients in the room. It is similar to when a u1 is sent by a client. Only clients that meet the requirements in the Filter will receive the message.

Parameters:
filter - - the filter to be used to determine if the client should receive the message
message - - the name of the message
args - - the args to be sent with the message

sendMessage

void sendMessage(java.util.Set<Client> clients,
                 java.lang.String message,
                 java.lang.String... args)
This generates a u7 which is sent to the clients in the list clients. Clients must also be in the room. It is similar to when a u1 is sent by a client. The Set of Clients is not synchronized by the implementation and the call must be synchronized if the Set can be mutated by other threads.

Parameters:
clients - - a set of clients to send the message to
message - - the name of the message
args - - the args to be sent with the message

getSimpleID

java.lang.String getSimpleID()
Returns the Simple ID of the room. Example: returns "GolfChat" for room with qualified ID "rooms.chat.GolfChat".

Returns:
the simple ID of the room

getQualifiedID

java.lang.String getQualifiedID()
Returns the ID including the qualifier for the room. Example: returns "rooms.chat.GolfChat" for room with qualified ID "rooms.chat.GolfChat".

Returns:
the qualified ID of the room

getOwnerID

java.lang.String getOwnerID()
Return the client ID of the owner of the room.

Returns:
the client ID of the owner of the room

getCreationTime

long getCreationTime()
Retrieves the time the room was created.

Returns:
the time the room was created

shutdownRoom

void shutdownRoom()
Shuts down this room and removes it from the server.


restart

void restart()
Restarts the room with the original RoomDef. The method effectively shuts the room down and then recreates the room with the original RoomDef. It is a new room and clients will have to reobserve or rejoin the room as necessary.


isShutdown

boolean isShutdown()
Indicates if this room has been shutdown. Generally a room will only be in a "shutdown" state for a very short time before it is removed from the server entirely.

Returns:
true if the room is shutdown and being removed, otherwise false

getClusterRole

ClusterRole getClusterRole()
Returns the role, if any, that the room has within the cluster (eg. MASTER vs SLAVE).

Returns:
the role, if any, that the room has within the cluster


Copyright USER1 Subsystems Corporation - Tue Jan 28 2014, 05:05 PM -0500