com.threerings.crowd.data
Class BodyObject

java.lang.Object
  extended by com.threerings.presents.dobj.DObject
      extended by com.threerings.presents.data.ClientObject
          extended by com.threerings.crowd.data.BodyObject
All Implemented Interfaces:
SpeakObject, Streamable

public class BodyObject
extends ClientObject
implements SpeakObject

The basic user object class for Crowd users. Bodies have a username, a location and a status.


Nested Class Summary
protected  class BodyObject.CrowdPermissionPolicy
           
 
Nested classes/interfaces inherited from class com.threerings.presents.data.ClientObject
ClientObject.PermissionPolicy
 
Nested classes/interfaces inherited from interface com.threerings.crowd.chat.data.SpeakObject
SpeakObject.ListenerOp
 
Nested classes/interfaces inherited from interface com.threerings.io.Streamable
Streamable.Closure
 
Field Summary
static String AWAY_MESSAGE
          The field name of the awayMessage field.
 String awayMessage
          If non-null, this contains a message to be auto-replied whenever another user delivers a tell message to this user.
protected static TokenRing EMPTY_TOKENS
          The default (no tokens) access control.
 Place location
          Identifies the place currently occupied by this body. null if they currently occupy no place.
static String LOCATION
          The field name of the location field.
 byte status
          The user's current status (OccupantInfo.ACTIVE, etc.).
static String STATUS
          The field name of the status field.
 
Fields inherited from class com.threerings.presents.data.ClientObject
_permPolicy, _references, CLOBJ_CHANGED, receivers, RECEIVERS, username, USERNAME
 
Fields inherited from class com.threerings.presents.dobj.DObject
_accessors, _atable, _controller, _deathWish, _listeners, _locattrs, _locks, _oid, _omgr, _scount, _subs, _tcancelled, _tcount, _tevent
 
Constructor Summary
BodyObject()
           
 
Method Summary
protected  void addWhoData(StringBuilder buf)
          Allows derived classes to add data to the who details.
 void applyToListeners(SpeakObject.ListenerOp op)
          The speak service will call this every time a chat message is delivered on this speak object to note the listeners that received the message.
 OccupantInfo createOccupantInfo(PlaceObject plobj)
          Creates a blank occupant info instance that will used to publish information about the various bodies occupying a place.
protected  ClientObject.PermissionPolicy createPermissionPolicy()
           
 void didLeavePlace(PlaceObject plobj)
          Called when this body has left its occupied place.
 ClientObject getClientObject()
          Return the ClientObject that represent our driving user's connection.
 int getPlaceOid()
          Returns the oid of the place occupied by this body or -1 if we occupy no place.
protected  String getStatusTranslation()
          Get a translation suffix for this occupant's status.
 TokenRing getTokens()
          Returns this user's access control tokens.
 Name getVisibleName()
          Returns the name that should be displayed to other users.
 void setAwayMessage(String value)
          Requests that the awayMessage field be set to the specified value.
 void setLocation(Place value)
          Requests that the location field be set to the specified value.
 void setStatus(byte value)
          Requests that the status field be set to the specified value.
 String who()
          Returns a short string identifying this client.
 void willEnterPlace(Place place, PlaceObject plobj)
          Called when this body is about to enter the specified place.
 
Methods inherited from class com.threerings.presents.data.ClientObject
addToReceivers, checkAccess, checkAccess, hasAccess, hasAccess, reference, release, removeFromReceivers, setReceivers, setUsername, updateReceivers
 
Methods inherited from class com.threerings.presents.dobj.DObject
acquireLock, addListener, addListener, addSubscriber, addToSet, cancelTransaction, changeAttribute, checkPermissions, checkPermissions, clearLock, clearTransaction, commitTransaction, createAccessors, destroy, getAccessController, getAccessor, getAttribute, getListenerIndex, getLocal, getLocals, getManager, getOid, getSet, inTransaction, isActive, isAuthoritative, notifyListeners, notifyProxies, postEvent, postMessage, postMessage, releaseLock, removeFromSet, removeListener, removeSubscriber, requestAttributeChange, requestAttributeChange, requestElementUpdate, requestElementUpdate, requestEntryAdd, requestEntryRemove, requestEntryUpdate, requestEntryUpdate, requestOidAdd, requestOidAdd, requestOidRemove, requestOidRemove, setAccessController, setAttribute, setDestroyOnLastSubscriberRemoved, setLocal, setManager, setOid, startTransaction, toString, toString, updateSet, which, which
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOCATION

@Generated(value="com.threerings.presents.tools.GenDObjectTask")
public static final String LOCATION
The field name of the location field.

See Also:
Constant Field Values

STATUS

@Generated(value="com.threerings.presents.tools.GenDObjectTask")
public static final String STATUS
The field name of the status field.

See Also:
Constant Field Values

AWAY_MESSAGE

@Generated(value="com.threerings.presents.tools.GenDObjectTask")
public static final String AWAY_MESSAGE
The field name of the awayMessage field.

See Also:
Constant Field Values

location

public Place location
Identifies the place currently occupied by this body. null if they currently occupy no place.


status

public byte status
The user's current status (OccupantInfo.ACTIVE, etc.).


awayMessage

public String awayMessage
If non-null, this contains a message to be auto-replied whenever another user delivers a tell message to this user.


EMPTY_TOKENS

protected static final TokenRing EMPTY_TOKENS
The default (no tokens) access control.

Constructor Detail

BodyObject

public BodyObject()
Method Detail

getPlaceOid

public int getPlaceOid()
Returns the oid of the place occupied by this body or -1 if we occupy no place.


getTokens

public TokenRing getTokens()
Returns this user's access control tokens.


getVisibleName

public Name getVisibleName()
Returns the name that should be displayed to other users. The default is to use ClientObject.username.


createOccupantInfo

public OccupantInfo createOccupantInfo(PlaceObject plobj)
Creates a blank occupant info instance that will used to publish information about the various bodies occupying a place.


willEnterPlace

public void willEnterPlace(Place place,
                           PlaceObject plobj)
Called when this body is about to enter the specified place. Configures our location field.

Parameters:
place - the identifying information for the place we are entering.
plobj - the distributed object for the place we are entering.

didLeavePlace

public void didLeavePlace(PlaceObject plobj)
Called when this body has left its occupied place. Clears our location field.

Parameters:
plobj - the distributed object for the place we just departed. This might be null if the place object has been destroyed.

applyToListeners

public void applyToListeners(SpeakObject.ListenerOp op)
Description copied from interface: SpeakObject
The speak service will call this every time a chat message is delivered on this speak object to note the listeners that received the message.

Specified by:
applyToListeners in interface SpeakObject

getClientObject

public ClientObject getClientObject()
Return the ClientObject that represent our driving user's connection. This is the reverse operation of BodyLocator.forClient and should match it. The default implementation assumes the client object and the body object are one and the same. Do not return null here once this object is in the wild.


who

public String who()
Description copied from class: ClientObject
Returns a short string identifying this client.

Overrides:
who in class ClientObject

setLocation

@Generated(value="com.threerings.presents.tools.GenDObjectTask")
public void setLocation(Place value)
Requests that the location field be set to the specified value. The local value will be updated immediately and an event will be propagated through the system to notify all listeners that the attribute did change. Proxied copies of this object (on clients) will apply the value change when they received the attribute changed notification.


setStatus

@Generated(value="com.threerings.presents.tools.GenDObjectTask")
public void setStatus(byte value)
Requests that the status field be set to the specified value. The local value will be updated immediately and an event will be propagated through the system to notify all listeners that the attribute did change. Proxied copies of this object (on clients) will apply the value change when they received the attribute changed notification.


setAwayMessage

@Generated(value="com.threerings.presents.tools.GenDObjectTask")
public void setAwayMessage(String value)
Requests that the awayMessage field be set to the specified value. The local value will be updated immediately and an event will be propagated through the system to notify all listeners that the attribute did change. Proxied copies of this object (on clients) will apply the value change when they received the attribute changed notification.


addWhoData

protected void addWhoData(StringBuilder buf)
Allows derived classes to add data to the who details.


getStatusTranslation

protected String getStatusTranslation()
Get a translation suffix for this occupant's status. Can be overridden to translate nonstandard statuses.


createPermissionPolicy

protected ClientObject.PermissionPolicy createPermissionPolicy()
Overrides:
createPermissionPolicy in class ClientObject