Inject the bureau registry.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5210 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-06-29 13:09:03 +00:00
parent 556c9024b8
commit 07b6aa9446
@@ -26,12 +26,14 @@ import java.util.Set;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.google.inject.Inject;
import com.google.inject.Singleton; import com.google.inject.Singleton;
import com.samskivert.util.StringUtil; import com.samskivert.util.StringUtil;
import com.samskivert.util.Invoker; import com.samskivert.util.Invoker;
import com.samskivert.util.ProcessLogger; import com.samskivert.util.ProcessLogger;
import com.threerings.presents.annotation.MainInvoker;
import com.threerings.presents.data.ClientObject; import com.threerings.presents.data.ClientObject;
import com.threerings.presents.dobj.ObjectDeathListener; import com.threerings.presents.dobj.ObjectDeathListener;
import com.threerings.presents.dobj.ObjectDestroyedEvent; import com.threerings.presents.dobj.ObjectDestroyedEvent;
@@ -90,20 +92,11 @@ public class BureauRegistry
} }
/** /**
* Creates a new registry, prepared to provide bureau services. * Creates an uninitialized registry.
*/ */
public BureauRegistry ( @Inject public BureauRegistry (InvocationManager invmgr)
String serverNameAndPort,
InvocationManager invmgr,
RootDObjectManager omgr,
Invoker invoker)
{ {
_serverNameAndPort = serverNameAndPort; invmgr.registerDispatcher(new BureauDispatcher(new BureauProvider () {
_invmgr = invmgr;
_omgr = omgr;
_invoker = invoker;
BureauProvider provider = new BureauProvider () {
public void bureauInitialized (ClientObject client, String bureauId) { public void bureauInitialized (ClientObject client, String bureauId) {
BureauRegistry.this.bureauInitialized(client, bureauId); BureauRegistry.this.bureauInitialized(client, bureauId);
} }
@@ -116,11 +109,15 @@ public class BureauRegistry
public void agentDestroyed (ClientObject client, int agentId) { public void agentDestroyed (ClientObject client, int agentId) {
BureauRegistry.this.agentDestroyed(client, agentId); BureauRegistry.this.agentDestroyed(client, agentId);
} }
}; }), BureauCodes.BUREAU_GROUP);
}
_invmgr.registerDispatcher( /**
new BureauDispatcher(provider), * Provides the Bureau registry with necessary runtime configuration.
BureauCodes.BUREAU_GROUP); */
public void init (String serverNameAndPort)
{
_serverNameAndPort = serverNameAndPort;
} }
/** /**
@@ -621,9 +618,9 @@ public class BureauRegistry
} }
protected String _serverNameAndPort; protected String _serverNameAndPort;
protected InvocationManager _invmgr;
protected RootDObjectManager _omgr;
protected Invoker _invoker;
protected Map<String, CommandGenerator> _generators = Maps.newHashMap(); protected Map<String, CommandGenerator> _generators = Maps.newHashMap();
protected Map<String, Bureau> _bureaus = Maps.newHashMap(); protected Map<String, Bureau> _bureaus = Maps.newHashMap();
@Inject protected RootDObjectManager _omgr;
@Inject protected @MainInvoker Invoker _invoker;
} }