com.threerings.bureau.client
Class BureauDirector

java.lang.Object
  extended by com.threerings.presents.client.BasicDirector
      extended by com.threerings.bureau.client.BureauDirector
All Implemented Interfaces:
SessionObserver

public abstract class BureauDirector
extends BasicDirector

Allows the server to create and destroy agents on a client.

See Also:
BureauRegistry

Field Summary
protected  IntMap<Agent> _agents
           
protected  BureauService _bureauService
           
protected  BureauContext _ctx
           
protected  IntMap<SafeSubscriber<AgentObject>> _subscribers
           
 
Fields inherited from class com.threerings.presents.client.BasicDirector
_availableInStandalone
 
Constructor Summary
BureauDirector(BureauContext ctx)
          Creates a new BureauDirector.
 
Method Summary
 void clientDidLogon(Client client)
          Called after the client successfully connected to and authenticated with the server.
protected abstract  Agent createAgent(AgentObject agentObj)
          Called when it is time to create an Agent.
protected  void createAgent(int agentId)
          Creates a new agent when the server requests it.
protected  void destroyAgent(int agentId)
          Destroys an agent at the server's request.
protected  void fetchServices(Client client)
          Derived directors can override this method and obtain any services they'll need during their operation via calls to Client.getService(java.lang.Class).
protected  void objectAvailable(AgentObject agentObject)
          Callback for when the a request to subscribe to an object finishes and the object is available.
protected  void registerServices(Client client)
          If a director makes use of bootstrap invocation services which are part of a bootstrap service group, it should register interest in that group here with a call to Client.addServiceGroup(java.lang.String).
protected  void requestFailed(int oid, ObjectAccessException cause)
          Callback for when the a request to subscribe to an object fails.
 
Methods inherited from class com.threerings.presents.client.BasicDirector
assertAvailable, clientDidLogoff, clientObjectDidChange, clientObjectUpdated, clientWillLogon, isAvailable, isAvailableInStandalone, setAvailableInStandalone
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_ctx

protected BureauContext _ctx

_bureauService

protected BureauService _bureauService

_agents

protected IntMap<Agent> _agents

_subscribers

protected IntMap<SafeSubscriber<AgentObject>> _subscribers
Constructor Detail

BureauDirector

public BureauDirector(BureauContext ctx)
Creates a new BureauDirector.

Method Detail

clientDidLogon

public void clientDidLogon(Client client)
Description copied from interface: SessionObserver
Called after the client successfully connected to and authenticated with the server. The entire object system is up and running by the time this method is called.

Specified by:
clientDidLogon in interface SessionObserver
Overrides:
clientDidLogon in class BasicDirector

createAgent

protected void createAgent(int agentId)
Creates a new agent when the server requests it.


destroyAgent

protected void destroyAgent(int agentId)
Destroys an agent at the server's request.


objectAvailable

protected void objectAvailable(AgentObject agentObject)
Callback for when the a request to subscribe to an object finishes and the object is available.


requestFailed

protected void requestFailed(int oid,
                             ObjectAccessException cause)
Callback for when the a request to subscribe to an object fails.


registerServices

protected void registerServices(Client client)
Description copied from class: BasicDirector
If a director makes use of bootstrap invocation services which are part of a bootstrap service group, it should register interest in that group here with a call to Client.addServiceGroup(java.lang.String).

Overrides:
registerServices in class BasicDirector

fetchServices

protected void fetchServices(Client client)
Description copied from class: BasicDirector
Derived directors can override this method and obtain any services they'll need during their operation via calls to Client.getService(java.lang.Class). If the director is available, it will automatically be called when the client logs on or when the director is constructed if it is constructed after the client is already logged on.

Overrides:
fetchServices in class BasicDirector

createAgent

protected abstract Agent createAgent(AgentObject agentObj)
Called when it is time to create an Agent. Subclasses should read the agentObject's type and/or properties to determine what kind of Agent to create.

Parameters:
agentObj - the distributed and object
Returns:
a new Agent that will govern the distributed object