Revamp! Modified the way configuration is handled.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1166 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// $Id: PresentsConfig.java,v 1.1 2002/03/28 22:32:32 mdb Exp $
|
||||
|
||||
package com.threerings.presents.server;
|
||||
|
||||
import com.samskivert.util.Config;
|
||||
|
||||
/**
|
||||
* Provides access to the Presents server configuration.
|
||||
*/
|
||||
public class PresentsConfig
|
||||
{
|
||||
/** Provides access to configuration data for this package. */
|
||||
public static Config config = new Config("rsrc/config/presents/server");
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: PresentsServer.java,v 1.18 2002/03/05 03:19:18 mdb Exp $
|
||||
// $Id: PresentsServer.java,v 1.19 2002/03/28 22:32:32 mdb Exp $
|
||||
|
||||
package com.threerings.presents.server;
|
||||
|
||||
@@ -25,9 +25,6 @@ public class PresentsServer
|
||||
/** The namespace used for server config properties. */
|
||||
public static final String CONFIG_KEY = "presents";
|
||||
|
||||
/** The server configuration. */
|
||||
public static Config config;
|
||||
|
||||
/** The manager of network connections. */
|
||||
public static ConnectionManager conmgr;
|
||||
|
||||
@@ -51,11 +48,6 @@ public class PresentsServer
|
||||
public void init ()
|
||||
throws Exception
|
||||
{
|
||||
// create our configuration object
|
||||
config = new Config();
|
||||
// bind the presents server config into the namespace
|
||||
config.bindProperties(CONFIG_KEY, CONFIG_PATH, true);
|
||||
|
||||
// create our distributed object manager
|
||||
omgr = new PresentsDObjectMgr();
|
||||
|
||||
@@ -64,7 +56,7 @@ public class PresentsServer
|
||||
invoker.start();
|
||||
|
||||
// create our connection manager
|
||||
conmgr = new ConnectionManager(config);
|
||||
conmgr = new ConnectionManager();
|
||||
conmgr.setAuthenticator(new DummyAuthenticator());
|
||||
|
||||
// create our client manager
|
||||
@@ -74,7 +66,9 @@ public class PresentsServer
|
||||
invmgr = new InvocationManager(omgr);
|
||||
|
||||
// register our invocation service providers
|
||||
registerProviders(config.getValue(PROVIDERS_KEY, (String[])null));
|
||||
String[] providers = null;
|
||||
providers = PresentsConfig.config.getValue(PROVIDERS_KEY, providers);
|
||||
registerProviders(providers);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,10 +176,6 @@ public class PresentsServer
|
||||
}
|
||||
}
|
||||
|
||||
// the path to the config file
|
||||
protected final static String CONFIG_PATH =
|
||||
"rsrc/config/presents/server";
|
||||
|
||||
// the config key for our list of invocation provider mappings
|
||||
protected final static String PROVIDERS_KEY = CONFIG_KEY + ".providers";
|
||||
protected final static String PROVIDERS_KEY = "providers";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ConnectionManager.java,v 1.17 2002/03/05 06:15:23 mdb Exp $
|
||||
// $Id: ConnectionManager.java,v 1.18 2002/03/28 22:32:32 mdb Exp $
|
||||
|
||||
package com.threerings.presents.server.net;
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.threerings.presents.net.AuthResponse;
|
||||
import com.threerings.presents.net.DownstreamMessage;
|
||||
|
||||
import com.threerings.presents.server.Authenticator;
|
||||
import com.threerings.presents.server.PresentsConfig;
|
||||
import com.threerings.presents.server.PresentsServer;
|
||||
|
||||
/**
|
||||
@@ -39,11 +40,12 @@ public class ConnectionManager extends LoopingThread
|
||||
* @param config A config object from which the connection manager
|
||||
* will fetch its configuration parameters.
|
||||
*/
|
||||
public ConnectionManager (Config config)
|
||||
public ConnectionManager ()
|
||||
throws IOException
|
||||
{
|
||||
// the listen port is specified in our configuration
|
||||
_port = config.getValue(CM_PORT_KEY, Client.DEFAULT_SERVER_PORT);
|
||||
_port = PresentsConfig.config.getValue(
|
||||
CM_PORT_KEY, Client.DEFAULT_SERVER_PORT);
|
||||
|
||||
// we use this to wait for activity on our sockets
|
||||
_selset = new SelectSet();
|
||||
@@ -347,8 +349,7 @@ public class ConnectionManager extends LoopingThread
|
||||
protected ArrayList _observers = new ArrayList();
|
||||
|
||||
/** The config key for our listening port. */
|
||||
protected static final String CM_PORT_KEY =
|
||||
PresentsServer.CONFIG_KEY + ".conmgr_port";
|
||||
protected static final String CM_PORT_KEY = "conmgr_port";
|
||||
|
||||
/**
|
||||
* How long we wait for network events before checking our running
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
//
|
||||
// $Id: PresentsContext.java,v 1.4 2001/10/11 04:07:53 mdb Exp $
|
||||
// $Id: PresentsContext.java,v 1.5 2002/03/28 22:32:33 mdb Exp $
|
||||
|
||||
package com.threerings.presents.util;
|
||||
|
||||
import com.samskivert.util.Context;
|
||||
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.dobj.DObjectManager;
|
||||
|
||||
public interface PresentsContext extends Context
|
||||
/**
|
||||
* Provides access to standard services needed by code that is part of or
|
||||
* uses the Presents package.
|
||||
*/
|
||||
public interface PresentsContext
|
||||
{
|
||||
/**
|
||||
* Returns a reference to the client. This reference should be valid
|
||||
|
||||
Reference in New Issue
Block a user