org.jdesktop.wonderland.server
Class UserMO

java.lang.Object
  extended by org.jdesktop.wonderland.server.UserMO
All Implemented Interfaces:
com.sun.sgs.app.ManagedObject, com.sun.sgs.app.ManagedObjectRemoval, java.io.Serializable

public class UserMO
extends java.lang.Object
implements com.sun.sgs.app.ManagedObject, java.io.Serializable, com.sun.sgs.app.ManagedObjectRemoval

This class represensents a real world user. A user can be logged into the system from multiple concurrent clients with different protocols For example a user may be logged in from a 3D client and a cell phone

Author:
paulby
See Also:
Serialized Form

Field Summary
protected static java.util.logging.Logger logger
           
 
Method Summary
 void addUserListener(UserListener listener)
          Add a listener to be notified when clients of this user log in or out.
 java.util.Collection<com.sun.sgs.app.ManagedReference<AvatarCellMO>> getAllAvatars()
          Return all avatars for this User
 AvatarCellMO getAvatar(WonderlandClientID clientID, java.lang.String avatarName)
          Return the specified avatar for this User and session, or null if that avatar does not exist
 java.lang.Object getExtendedData(java.lang.String name)
          Return the object associated with the name.
 WonderlandIdentity getIdentity()
          Get unique identity
 java.util.Queue<com.sun.sgs.app.Task> getLogoutTasks(WonderlandClientID clientID)
          Get the logout tasks for a given clientID.
 com.sun.sgs.app.ManagedReference getReference()
          Convenience method that returns the ManagedReference to this ManagedObject
 java.lang.String getUsername()
           
 void putAvatar(WonderlandClientID clientID, java.lang.String avatarName, AvatarCellMO avatar)
          Put the avatarRef and the name in the set of avatars for this user.
 void putExtendedData(java.lang.String name, java.io.Serializable object)
          Put a named object in the extended data Map for this User This name/object pairing allows developers to add data to the user class without needing to modify the userMO class.
 void removeUserListener(UserListener listener)
          Remove a user listener from this user
 void removingObject()
          Clean up managed objects we create.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static java.util.logging.Logger logger
Method Detail

getIdentity

public WonderlandIdentity getIdentity()
Get unique identity

Returns:

getUsername

public java.lang.String getUsername()

putExtendedData

public void putExtendedData(java.lang.String name,
                            java.io.Serializable object)
Put a named object in the extended data Map for this User This name/object pairing allows developers to add data to the user class without needing to modify the userMO class.

Parameters:
name -
object -

getExtendedData

public java.lang.Object getExtendedData(java.lang.String name)
Return the object associated with the name.

Parameters:
name -
Returns:
Object, or null if their is no object associated with the given name

getAvatar

public AvatarCellMO getAvatar(WonderlandClientID clientID,
                              java.lang.String avatarName)
Return the specified avatar for this User and session, or null if that avatar does not exist

Parameters:
avatarName -
Returns:

getAllAvatars

public java.util.Collection<com.sun.sgs.app.ManagedReference<AvatarCellMO>> getAllAvatars()
Return all avatars for this User

Returns:
all the user's avatars

putAvatar

public void putAvatar(WonderlandClientID clientID,
                      java.lang.String avatarName,
                      AvatarCellMO avatar)
Put the avatarRef and the name in the set of avatars for this user. Each ClientSession can have a set of avatars.

Parameters:
avatarName -
avatar -

getLogoutTasks

public java.util.Queue<com.sun.sgs.app.Task> getLogoutTasks(WonderlandClientID clientID)
Get the logout tasks for a given clientID. The client must be in the process of logging out (i.e. between when startLogout() is called and loggedOut() is called). If the client is not in the process of logging out, this method will return null.

Parameters:
clientID - the client ID to get logout tasks for
Returns:
the tasks for the given user, or null if the user is not in the process of logging out

addUserListener

public void addUserListener(UserListener listener)
Add a listener to be notified when clients of this user log in or out.

Parameters:
listener - the listener to notify on log in or log out. Listener must implement ManagedObject.

removeUserListener

public void removeUserListener(UserListener listener)
Remove a user listener from this user

Parameters:
listener - the listener to remove

getReference

public com.sun.sgs.app.ManagedReference getReference()
Convenience method that returns the ManagedReference to this ManagedObject

Returns:

removingObject

public void removingObject()
Clean up managed objects we create.

Specified by:
removingObject in interface com.sun.sgs.app.ManagedObjectRemoval


Open Wonderland - http://openwonderland.org