Basic Guice compliance.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@529 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Michael Bayne
2008-06-07 17:45:10 +00:00
parent 70ef6a644a
commit 935cf0e7c2
2 changed files with 10 additions and 5 deletions
+1
View File
@@ -10,6 +10,7 @@
<include name="commons-logging.jar"/> <include name="commons-logging.jar"/>
<include name="commons-beanutils.jar"/> <include name="commons-beanutils.jar"/>
<include name="google-collect.jar"/> <include name="google-collect.jar"/>
<include name="guice.jar"/>
<include name="junit4.jar"/> <include name="junit4.jar"/>
<include name="retroweaver-all-1.2.2.jar"/> <include name="retroweaver-all-1.2.2.jar"/>
<include name="xml-writer.jar"/> <include name="xml-writer.jar"/>
@@ -3,6 +3,9 @@
package com.threerings.jme.server; package com.threerings.jme.server;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.threerings.crowd.data.PlaceObject; import com.threerings.crowd.data.PlaceObject;
import com.threerings.crowd.server.CrowdServer; import com.threerings.crowd.server.CrowdServer;
import com.threerings.crowd.server.PlaceManager; import com.threerings.crowd.server.PlaceManager;
@@ -17,11 +20,11 @@ import static com.threerings.crowd.Log.log;
*/ */
public class JabberServer extends CrowdServer public class JabberServer extends CrowdServer
{ {
// documentation inherited @Override // from CrowdServer
public void init () public void init (Injector injector)
throws Exception throws Exception
{ {
super.init(); super.init(injector);
// create a single location // create a single location
_place = plreg.createPlace(new JabberConfig()); _place = plreg.createPlace(new JabberConfig());
@@ -30,9 +33,10 @@ public class JabberServer extends CrowdServer
public static void main (String[] args) public static void main (String[] args)
{ {
JabberServer server = new JabberServer(); Injector injector = Guice.createInjector(new Module());
JabberServer server = injector.getInstance(JabberServer.class);
try { try {
server.init(); server.init(injector);
server.run(); server.run();
} catch (Exception e) { } catch (Exception e) {
log.warning("Unable to initialize server.", e); log.warning("Unable to initialize server.", e);