org.moock.unity.core.upc
Class UPCRoom

java.lang.Object
  |
  +--org.moock.unity.core.upc.UPCRoom
All Implemented Interfaces:
RoomListener

public class UPCRoom
extends java.lang.Object
implements RoomListener

This room uses UPC calls to interact with Unity server. It contains many UPC calls for interacting with the server without having to extend the room. However, you can extend UPCRoom and se the handleMessage method to extend functionality even further.


Field Summary
static java.lang.String ATTR_CLIENTLISTNOTIFICATION
           
static java.lang.String ATTR_PASSWORD
           
protected static org.apache.log4j.Logger s_log
           
 
Constructor Summary
UPCRoom()
           
 
Method Summary
 void doChangePersistentClient(UPCMessage upcIN, Message message)
           
 void doCreateNamespace(UPCMessage upcIN, Message message)
          Process createNamespace UPC
 void doCreatePersistentClient(UPCMessage upcIN, Message message)
           
 void doCreateRoom(UPCMessage upcIN, Message message)
          Process createRoom UPC
 void doGetClientID(UPCMessage upcIN, Message message)
          Process getClientID UPC
 void doGetNamespaceList(UPCMessage upcIN, Message message)
           
 void doGetNumUsers(UPCMessage upcIN, Message message)
           
 void doGetRoomList(UPCMessage upcIN, Message message)
          Process getRoomList UPC
 void doInvokeOnAll(UPCMessage upcIN, Message message)
          Process InvokeOnAll UPC
 void doInvokeOnAllButClient(UPCMessage upcIN, Message message)
          Process InvokeOnAllButClient UPC
 void doInvokeOnClient(UPCMessage upcIN, Message message)
          Process InvokeOnClient UPC
 void doInvokeOnNamespace(UPCMessage upcIN, Message message)
          Process invokeOnNamespace UPC
 void doInvokeOnRoom(UPCMessage upcIN, Message message)
          Process invokeOnRoom UPC
 void doJoinRoom(UPCMessage upcIN, Message message)
          Process joinRoom UPC
 void doLeaveRoom(UPCMessage upcIN, Message message)
          Process leaveRoom UPC
 void doLoginClient(UPCMessage upcIN, Message message)
           
 void doObserveNamespace(UPCMessage upcIN, Message message)
           
 void doRemoveNamespace(UPCMessage upcIN, Message message)
           
 void doRemovePersistentClient(UPCMessage upcIN, Message message)
           
 void doRemoveRoom(UPCMessage upcIN, Message message)
           
 void doSetClientAttribute(UPCMessage upcIN, Message message)
          Process upcSetClientAttribute UPC
 void doSetRoomAttribute(UPCMessage upcIN, Message message)
           
 void doStopObserveNamespace(UPCMessage upcIN, Message message)
           
 java.lang.String getOwner()
           
 RoomServices getRoomServices()
          Return the RoomServices for this UPCRoom.
 void handleMessage(UPCMessage upcMessage, Message message)
          Handle custom messages here.
 void onAddClient(ClientServices client)
          Called when a Client joins the room.
 void onClientCountChange(int newCount)
          Called when the number of clients in the room changes.
 boolean onLogin(ClientServices client, java.util.ArrayList args)
          If the UPCRoom has a password (set as an attribute when creating the Room) then Clients must login to gain access.
 void onReceiveMessage(Message message)
          Called when the Room receives a Message from a Client.
 void onRemoveClient(ClientServices client)
          Called when a Client is removed.
 void onRoomDie()
          Called when the Room is asked to be killed but before Clients are removed and the Room is removed from the Server.
 void onRoomInit(RoomServices roomServices)
          Called when the Room is started.
 void setOwner(java.lang.String clientID)
          Sets the owner of this room to the ID clientID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s_log

protected static org.apache.log4j.Logger s_log

ATTR_CLIENTLISTNOTIFICATION

public static final java.lang.String ATTR_CLIENTLISTNOTIFICATION

ATTR_PASSWORD

public static final java.lang.String ATTR_PASSWORD
Constructor Detail

UPCRoom

public UPCRoom()
Method Detail

onLogin

public boolean onLogin(ClientServices client,
                       java.util.ArrayList args)
If the UPCRoom has a password (set as an attribute when creating the Room) then Clients must login to gain access. It takes the attempted password as the first argument in args.
Specified by:
onLogin in interface RoomListener
Following copied from interface: org.moock.unity.core.RoomListener
Returns:
true if the Client should be granted access.

onRoomInit

public void onRoomInit(RoomServices roomServices)
Description copied from interface: RoomListener
Called when the Room is started.
Specified by:
onRoomInit in interface RoomListener
Following copied from interface: org.moock.unity.core.RoomListener
Parameters:
RoomServices - the RoomServices for this Room

onReceiveMessage

public void onReceiveMessage(Message message)
Description copied from interface: RoomListener
Called when the Room receives a Message from a Client.
Specified by:
onReceiveMessage in interface RoomListener

onAddClient

public void onAddClient(ClientServices client)
Description copied from interface: RoomListener
Called when a Client joins the room.
Specified by:
onAddClient in interface RoomListener

onClientCountChange

public void onClientCountChange(int newCount)
Description copied from interface: RoomListener
Called when the number of clients in the room changes.
Specified by:
onClientCountChange in interface RoomListener

onRemoveClient

public void onRemoveClient(ClientServices client)
Description copied from interface: RoomListener
Called when a Client is removed.
Specified by:
onRemoveClient in interface RoomListener

onRoomDie

public void onRoomDie()
Description copied from interface: RoomListener
Called when the Room is asked to be killed but before Clients are removed and the Room is removed from the Server. Perform cleanup of resources used by the Room here.
Specified by:
onRoomDie in interface RoomListener

handleMessage

public void handleMessage(UPCMessage upcMessage,
                          Message message)
Handle custom messages here. UPCRoom will pass this any messages it cannot handle.
Parameters:
upcMessage - the UPCMessage object representing the UPC
message - the raw Message received
Returns:
boolean

doInvokeOnAll

public void doInvokeOnAll(UPCMessage upcIN,
                          Message message)
Process InvokeOnAll UPC

doInvokeOnAllButClient

public void doInvokeOnAllButClient(UPCMessage upcIN,
                                   Message message)
Process InvokeOnAllButClient UPC

doInvokeOnClient

public void doInvokeOnClient(UPCMessage upcIN,
                             Message message)
Process InvokeOnClient UPC

doGetClientID

public void doGetClientID(UPCMessage upcIN,
                          Message message)
Process getClientID UPC

doCreateRoom

public void doCreateRoom(UPCMessage upcIN,
                         Message message)
Process createRoom UPC

doGetRoomList

public void doGetRoomList(UPCMessage upcIN,
                          Message message)
Process getRoomList UPC

doJoinRoom

public void doJoinRoom(UPCMessage upcIN,
                       Message message)
Process joinRoom UPC

doInvokeOnNamespace

public void doInvokeOnNamespace(UPCMessage upcIN,
                                Message message)
Process invokeOnNamespace UPC

doInvokeOnRoom

public void doInvokeOnRoom(UPCMessage upcIN,
                           Message message)
Process invokeOnRoom UPC

doCreateNamespace

public void doCreateNamespace(UPCMessage upcIN,
                              Message message)
Process createNamespace UPC

doLeaveRoom

public void doLeaveRoom(UPCMessage upcIN,
                        Message message)
Process leaveRoom UPC

doSetClientAttribute

public void doSetClientAttribute(UPCMessage upcIN,
                                 Message message)
Process upcSetClientAttribute UPC

doSetRoomAttribute

public void doSetRoomAttribute(UPCMessage upcIN,
                               Message message)

doRemoveRoom

public void doRemoveRoom(UPCMessage upcIN,
                         Message message)

doGetNumUsers

public void doGetNumUsers(UPCMessage upcIN,
                          Message message)

doObserveNamespace

public void doObserveNamespace(UPCMessage upcIN,
                               Message message)

doStopObserveNamespace

public void doStopObserveNamespace(UPCMessage upcIN,
                                   Message message)

doRemoveNamespace

public void doRemoveNamespace(UPCMessage upcIN,
                              Message message)

doGetNamespaceList

public void doGetNamespaceList(UPCMessage upcIN,
                               Message message)

doLoginClient

public void doLoginClient(UPCMessage upcIN,
                          Message message)

doCreatePersistentClient

public void doCreatePersistentClient(UPCMessage upcIN,
                                     Message message)

doRemovePersistentClient

public void doRemovePersistentClient(UPCMessage upcIN,
                                     Message message)

doChangePersistentClient

public void doChangePersistentClient(UPCMessage upcIN,
                                     Message message)

setOwner

public void setOwner(java.lang.String clientID)
Sets the owner of this room to the ID clientID

getRoomServices

public RoomServices getRoomServices()
Return the RoomServices for this UPCRoom.

getOwner

public java.lang.String getOwner()