net.user1.union.api
Interface Room

All Superinterfaces:
AttributeHolder, EventProducer

public interface Room
extends AttributeHolder, EventProducer

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


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.
 Set<Client> getClients()
          Returns a reference to all of clients in the room.
 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.
 String getQualifiedID()
          Returns the ID including the qualifier for the room.
 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, String message, String... args)
          This generates a u7 which is sent to all clients in the room.
 void sendMessage(Set<Client> clients, String message, String... args)
          This generates a u7 which is sent to the clients in the list clients.
 void sendMessage(String message, 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.EventProducer
addEventListener, removeEventListener
 

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

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(String message,
                 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,
                 String message,
                 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(Set<Client> clients,
                 String message,
                 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.

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

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

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

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


Copyright USER1 Subsystems Corporation