com.threerings.config.dist.client
Class DConfigDirector

java.lang.Object
  extended by com.threerings.presents.client.BasicDirector
      extended by com.threerings.config.dist.client.DConfigDirector
All Implemented Interfaces:
ConfigGroupListener<ManagedConfig>, ConfigUpdateListener<ManagedConfig>, SessionObserver, Subscriber<DConfigObject>

public class DConfigDirector
extends BasicDirector
implements Subscriber<DConfigObject>, ConfigGroupListener<ManagedConfig>, ConfigUpdateListener<ManagedConfig>

Handles the client side of the distributed config system.


Field Summary
protected  Map<ConfigKey,ConfigEntry> _added
          The set of added entries pending transmission.
protected  ChangeBlock _block
          Indicates that we should ignore any changes, because we're the one effecting them.
protected  ConfigManager _cfgmgr
          The root config manager.
protected  DConfigObject _cfgobj
          The config object.
protected  long _lastTransmit
          The time at which the last update was sent.
protected  Set<ConfigKey> _removed
          The set of removed keys pending transmission.
protected  Interval _transmitInterval
          Invokes the transmit method.
protected  Map<ConfigKey,ConfigEntry> _updated
          The set of updated entries pending transmission.
protected static long MIN_TRANSMIT_INTERVAL
          The minimum amount of time between updates.
 
Fields inherited from class com.threerings.presents.client.BasicDirector
_availableInStandalone, _ctx
 
Constructor Summary
DConfigDirector(PresentsContext ctx, ConfigManager cfgmgr)
          Creates a new distributed config director.
 
Method Summary
 void clientDidLogoff(Client client)
           
protected  boolean clientIsAdmin()
          Determines whether the local client is logged in as an admin.
 void configAdded(ConfigEvent<ManagedConfig> event)
          Called when a configuration has been added to the group.
 void configRemoved(ConfigEvent<ManagedConfig> event)
          Called when a configuration has been removed from the group.
 void configUpdated(ConfigEvent<ManagedConfig> event)
          Called when a configuration has been updated.
protected  void fetchServices(Client client)
           
protected  void maybeTransmitUpdate()
          Transmits all pending updates to the server if appropriate.
 void objectAvailable(DConfigObject cfgobj)
           
 void requestFailed(int oid, ObjectAccessException cause)
           
 
Methods inherited from class com.threerings.presents.client.BasicDirector
assertAvailable, clientDidLogon, clientObjectDidChange, clientObjectUpdated, clientWillLogon, isAvailable, isAvailableInStandalone, registerServices, setAvailableInStandalone
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_cfgmgr

protected ConfigManager _cfgmgr
The root config manager.


_cfgobj

protected DConfigObject _cfgobj
The config object.


_block

protected ChangeBlock _block
Indicates that we should ignore any changes, because we're the one effecting them.


_added

protected Map<ConfigKey,ConfigEntry> _added
The set of added entries pending transmission.


_updated

protected Map<ConfigKey,ConfigEntry> _updated
The set of updated entries pending transmission.


_removed

protected Set<ConfigKey> _removed
The set of removed keys pending transmission.


_lastTransmit

protected long _lastTransmit
The time at which the last update was sent.


_transmitInterval

protected Interval _transmitInterval
Invokes the transmit method.


MIN_TRANSMIT_INTERVAL

protected static final long MIN_TRANSMIT_INTERVAL
The minimum amount of time between updates.

See Also:
Constant Field Values
Constructor Detail

DConfigDirector

public DConfigDirector(PresentsContext ctx,
                       ConfigManager cfgmgr)
Creates a new distributed config director.

Method Detail

objectAvailable

public void objectAvailable(DConfigObject cfgobj)
Specified by:
objectAvailable in interface Subscriber<DConfigObject>

requestFailed

public void requestFailed(int oid,
                          ObjectAccessException cause)
Specified by:
requestFailed in interface Subscriber<DConfigObject>

configAdded

public void configAdded(ConfigEvent<ManagedConfig> event)
Description copied from interface: ConfigGroupListener
Called when a configuration has been added to the group.

Specified by:
configAdded in interface ConfigGroupListener<ManagedConfig>

configRemoved

public void configRemoved(ConfigEvent<ManagedConfig> event)
Description copied from interface: ConfigGroupListener
Called when a configuration has been removed from the group.

Specified by:
configRemoved in interface ConfigGroupListener<ManagedConfig>

configUpdated

public void configUpdated(ConfigEvent<ManagedConfig> event)
Description copied from interface: ConfigUpdateListener
Called when a configuration has been updated.

Specified by:
configUpdated in interface ConfigUpdateListener<ManagedConfig>

clientDidLogoff

public void clientDidLogoff(Client client)
Specified by:
clientDidLogoff in interface SessionObserver
Overrides:
clientDidLogoff in class BasicDirector

fetchServices

protected void fetchServices(Client client)
Overrides:
fetchServices in class BasicDirector

maybeTransmitUpdate

protected void maybeTransmitUpdate()
Transmits all pending updates to the server if appropriate.


clientIsAdmin

protected boolean clientIsAdmin()
Determines whether the local client is logged in as an admin.