com.threerings.presents.data
Class ClientObject

java.lang.Object
  extended by com.threerings.presents.dobj.DObject
      extended by com.threerings.presents.data.ClientObject
All Implemented Interfaces:
Streamable
Direct Known Subclasses:
BodyObject, BureauClientObject

public class ClientObject
extends DObject

A distributed object to which only the client subscribes. Used to deliver messages solely to a particular client as well as to publish client-specific data.


Field Summary
protected  PermissionPolicy _permPolicy
          Handles our fine-grained permissions.
protected  int _references
          Used to reference count resolved client objects.
static String CLOBJ_CHANGED
          The name of a message event delivered to the client when they switch usernames (and therefore user objects).
 DSet<InvocationReceiver.Registration> receivers
          Used to publish all invocation service receivers registered on this client.
static String RECEIVERS
          The field name of the receivers field.
 Name username
          This client's authentication username.
static String USERNAME
          The field name of the username field.
 
Fields inherited from class com.threerings.presents.dobj.DObject
_controller, _deathWish, _fields, _ftable, _listeners, _locattrs, _locks, _oid, _omgr, _scount, _subs, _tcancelled, _tcount, _tevent, FIELD_COMP, NO_ATTRS
 
Constructor Summary
ClientObject()
           
 
Method Summary
 void addToReceivers(InvocationReceiver.Registration elem)
          Requests that the specified entry be added to the receivers set.
 String checkAccess(Permission perm)
          A version of checkAccess(Permission,Object) that provides no context.
 String checkAccess(Permission perm, Object context)
          Checks whether or not this client has the specified permission.
 boolean hasAccess(Permission perm)
          Convenience wrapper around checkAccess(Permission) that simply returns a boolean indicating whether or not this client has the permission rather than an explanation.
 boolean hasAccess(Permission perm, Object context)
          Convenience wrapper around checkAccess(Permission,Object) that simply returns a boolean indicating whether or not this client has the permission rather than an explanation.
 void reference()
          Used for reference counting client objects, adds a reference to this object.
 boolean release()
          Used for reference counting client objects, releases a reference to this object.
 void removeFromReceivers(Comparable<?> key)
          Requests that the entry matching the supplied key be removed from the receivers set.
 void setPermissionPolicy(PermissionPolicy policy)
          Configures this client with a permissions policy.
 void setReceivers(DSet<InvocationReceiver.Registration> value)
          Requests that the receivers field be set to the specified value.
 void setUsername(Name value)
          Requests that the username field be set to the specified value.
 void updateReceivers(InvocationReceiver.Registration elem)
          Requests that the specified entry be updated in the receivers set.
 String who()
          Returns a short string identifying this client.
 
Methods inherited from class com.threerings.presents.dobj.DObject
acquireLock, addListener, addListener, addSubscriber, addToSet, cancelTransaction, changeAttribute, checkPermissions, checkPermissions, clearLock, clearTransaction, commitTransaction, destroy, getAccessController, getAttribute, getField, getListenerIndex, getLocal, getLocals, getManager, getOid, getSet, inTransaction, isActive, notifyListeners, notifyProxies, postEvent, postMessage, postMessage, releaseLock, removeFromSet, removeListener, removeSubscriber, requestAttributeChange, requestAttributeChange, requestElementUpdate, requestElementUpdate, requestEntryAdd, requestEntryRemove, requestEntryUpdate, requestEntryUpdate, requestOidAdd, 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

USERNAME

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

See Also:
Constant Field Values

RECEIVERS

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

See Also:
Constant Field Values

CLOBJ_CHANGED

public static final String CLOBJ_CHANGED
The name of a message event delivered to the client when they switch usernames (and therefore user objects).

See Also:
Constant Field Values

username

public Name username
This client's authentication username.


receivers

public DSet<InvocationReceiver.Registration> receivers
Used to publish all invocation service receivers registered on this client.


_permPolicy

protected PermissionPolicy _permPolicy
Handles our fine-grained permissions.


_references

protected transient int _references
Used to reference count resolved client objects.

Constructor Detail

ClientObject

public ClientObject()
Method Detail

setPermissionPolicy

public void setPermissionPolicy(PermissionPolicy policy)
Configures this client with a permissions policy. This is done during client resolution.


who

public String who()
Returns a short string identifying this client.


checkAccess

public String checkAccess(Permission perm,
                          Object context)
Checks whether or not this client has the specified permission.

Returns:
null if the user has access, a fully-qualified translatable message string indicating the reason for denial of access.
See Also:
PermissionPolicy

checkAccess

public String checkAccess(Permission perm)
A version of checkAccess(Permission,Object) that provides no context.


hasAccess

public boolean hasAccess(Permission perm,
                         Object context)
Convenience wrapper around checkAccess(Permission,Object) that simply returns a boolean indicating whether or not this client has the permission rather than an explanation.


hasAccess

public boolean hasAccess(Permission perm)
Convenience wrapper around checkAccess(Permission) that simply returns a boolean indicating whether or not this client has the permission rather than an explanation.


reference

public void reference()
Used for reference counting client objects, adds a reference to this object.


release

public boolean release()
Used for reference counting client objects, releases a reference to this object.

Returns:
true if the object has remaining references, false otherwise.

setUsername

@Generated(value="com.threerings.presents.tools.GenDObjectTask")
public void setUsername(Name value)
Requests that the username 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.


addToReceivers

@Generated(value="com.threerings.presents.tools.GenDObjectTask")
public void addToReceivers(InvocationReceiver.Registration elem)
Requests that the specified entry be added to the receivers set. The set will not change until the event is actually propagated through the system.


removeFromReceivers

@Generated(value="com.threerings.presents.tools.GenDObjectTask")
public void removeFromReceivers(Comparable<?> key)
Requests that the entry matching the supplied key be removed from the receivers set. The set will not change until the event is actually propagated through the system.


updateReceivers

@Generated(value="com.threerings.presents.tools.GenDObjectTask")
public void updateReceivers(InvocationReceiver.Registration elem)
Requests that the specified entry be updated in the receivers set. The set will not change until the event is actually propagated through the system.


setReceivers

@Generated(value="com.threerings.presents.tools.GenDObjectTask")
public void setReceivers(DSet<InvocationReceiver.Registration> value)
Requests that the receivers field be set to the specified value. Generally one only adds, updates and removes entries of a distributed set, but certain situations call for a complete replacement of the set 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.