Holy fruity beverage Batman! I'm taking the plunge and switching to Guice for
dependency resolution and management. Things are currently in a state of transition, but the important patterns have been established and I'll aim to sweep through all of Narya, Nenya and Vilya in the near future and do everything properly. Going through the other million-odd lines of code we have scattered across our various projects that use these libraries is not something I plan to do, so we'll be maintaining backward compatibility with the old static member method, though I hope to strive toward eradication of that usage entirely in MSOY while we still have a fighting chance. Given that some of our projects will continue to use the static member method in perpetuity, I'm not going to @Deprecate those fields because that would fill their logs with so much spam that they'd have to turn off deprecation warnings which would make life worse for them. So instead we'll settle for the big scary comment warning people away from the old bits. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5153 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -21,6 +21,9 @@
|
||||
|
||||
package com.threerings.bureau.server;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
import com.threerings.presents.server.PresentsServer;
|
||||
|
||||
import static com.threerings.bureau.Log.log;
|
||||
@@ -40,9 +43,10 @@ public class TestServer extends PresentsServer
|
||||
*/
|
||||
public static void main (String[] args)
|
||||
{
|
||||
final TestServer server = new TestServer();
|
||||
Injector injector = Guice.createInjector(new Module());
|
||||
TestServer server = injector.getInstance(TestServer.class);
|
||||
try {
|
||||
server.init();
|
||||
server.init(injector);
|
||||
setClientTarget("bureau-runclient");
|
||||
server.run();
|
||||
|
||||
@@ -51,20 +55,20 @@ public class TestServer extends PresentsServer
|
||||
}
|
||||
}
|
||||
|
||||
// inherit documentation - from PresentsServer
|
||||
public void init ()
|
||||
@Override // from PresentsServer
|
||||
public void init (Injector injector)
|
||||
throws Exception
|
||||
{
|
||||
super.init();
|
||||
super.init(injector);
|
||||
breg = new BureauRegistry("localhost:47624", invmgr, omgr, invoker);
|
||||
}
|
||||
|
||||
static public void setClientTarget (String target)
|
||||
public static void setClientTarget (String target)
|
||||
{
|
||||
breg.setCommandGenerator("test", antCommandGenerator(target));
|
||||
}
|
||||
|
||||
static public BureauRegistry.CommandGenerator antCommandGenerator (
|
||||
public static BureauRegistry.CommandGenerator antCommandGenerator (
|
||||
final String target)
|
||||
{
|
||||
return new BureauRegistry.CommandGenerator() {
|
||||
|
||||
Reference in New Issue
Block a user