org.jdesktop.wonderland.server.comms
Class WonderlandClientID

java.lang.Object
  extended by org.jdesktop.wonderland.server.comms.WonderlandClientID
All Implemented Interfaces:
java.io.Serializable

public class WonderlandClientID
extends java.lang.Object
implements java.io.Serializable

Identifies a WonderlandClient. This is a wrapper around the Darkstar clientSession for this client.

Author:
jkaplan
See Also:
Serialized Form

Constructor Summary
protected WonderlandClientID()
          For subclass constructor
  WonderlandClientID(com.sun.sgs.app.ClientSession session)
          Create a new clientID from the given ClientSession
  WonderlandClientID(com.sun.sgs.app.ManagedReference<com.sun.sgs.app.ClientSession> sessionRef)
          Create a new clientID from the given reference to a ClientSession
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compare session IDs based on the sessionRef object.
 java.math.BigInteger getID()
          Get the unique ID of this client.
 com.sun.sgs.app.ClientSession getSession()
          Get the ClientSession this for this client.
 int hashCode()
          Generate a hash code based on the sessionRef
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WonderlandClientID

protected WonderlandClientID()
For subclass constructor


WonderlandClientID

public WonderlandClientID(com.sun.sgs.app.ClientSession session)
Create a new clientID from the given ClientSession

Parameters:
session - the session to wrap

WonderlandClientID

public WonderlandClientID(com.sun.sgs.app.ManagedReference<com.sun.sgs.app.ClientSession> sessionRef)
Create a new clientID from the given reference to a ClientSession

Parameters:
sessionRef - a reference from a clientSession
Method Detail

getID

public java.math.BigInteger getID()
Get the unique ID of this client. This ID is the same as the one returned by the WonderlandSession.getID() method on the client.

Returns:
a unique ID for this client

getSession

public com.sun.sgs.app.ClientSession getSession()
Get the ClientSession this for this client. Note that the ClientSession.send() method should not be used directly. Instead, use WonderlandClientSender.send(WonderlandClientID, message).

Returns:
the session associated with this client, or null if the session has expired because the user logged out.

equals

public boolean equals(java.lang.Object obj)
Compare session IDs based on the sessionRef object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the other object
Returns:
true if obj is a WonderlandClientID with the same sessionRef

hashCode

public int hashCode()
Generate a hash code based on the sessionRef

Overrides:
hashCode in class java.lang.Object
Returns:
a hashcode based on the sessionRef


Open Wonderland - http://openwonderland.org