Config clean up and unification. The base servers were doing more than

they needed to and when all that was stripped away, they didn't really
need their own config files.

Now what little config they need is provided by the users of these basic
services so that said users can make their own decisions about where to
obtain configuration information.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1820 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-10-21 20:56:21 +00:00
parent 2b345cb8cf
commit a0e9044e93
13 changed files with 21 additions and 266 deletions
@@ -1,27 +0,0 @@
//
// $Id: PresentsConfig.java,v 1.2 2002/05/28 22:25:44 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");
/**
* Returns the list of invocation service providers to be registered
* at server startup.
*/
public static String[] getProviders ()
{
return config.getValue(PROVIDERS_KEY, (String[])null);
}
/** The config key for our list of invocation provider mappings. */
protected final static String PROVIDERS_KEY = "providers";
}
@@ -1,9 +1,10 @@
//
// $Id: PresentsServer.java,v 1.25 2002/10/01 05:15:45 mdb Exp $
// $Id: PresentsServer.java,v 1.26 2002/10/21 20:56:20 mdb Exp $
package com.threerings.presents.server;
import com.threerings.presents.Log;
import com.threerings.presents.client.Client;
import com.threerings.presents.dobj.DObjectManager;
import com.threerings.presents.server.net.ConnectionManager;
import com.threerings.presents.util.Invoker;
@@ -20,9 +21,6 @@ import com.threerings.presents.util.Invoker;
*/
public class PresentsServer
{
/** The namespace used for server config properties. */
public static final String CONFIG_KEY = "presents";
/** The manager of network connections. */
public static ConnectionManager conmgr;
@@ -54,7 +52,7 @@ public class PresentsServer
invoker.start();
// create our connection manager
conmgr = new ConnectionManager();
conmgr = new ConnectionManager(getListenPort());
conmgr.setAuthenticator(new DummyAuthenticator());
// create our client manager
@@ -65,58 +63,16 @@ public class PresentsServer
// initialize the time base services
TimeBaseProvider.init(invmgr, omgr);
// // register our invocation service providers
// registerProviders(PresentsConfig.getProviders());
}
// /**
// * Registers invocation service providers as parsed from a
// * configuration file. Each string in the array should contain an
// * expression of the form:
// *
// * <pre>
// * module = provider fully-qualified class name
// * </pre>
// *
// * A comma separated list of these can be specified in the
// * configuration file and loaded into a string array easily. These
// * providers will be instantiated and registered with the invocation
// * manager.
// */
// protected void registerProviders (String[] providers)
// {
// // ignore null arrays to make life easier for the caller
// if (providers == null) {
// return;
// }
// for (int i = 0; i < providers.length; i++) {
// int eidx = providers[i].indexOf("=");
// if (eidx == -1) {
// Log.warning("Ignoring bogus provider declaration " +
// "[decl=" + providers[i] + "].");
// continue;
// }
// String module = providers[i].substring(0, eidx).trim();
// String pname = providers[i].substring(eidx+1).trim();
// // instantiate the provider class and register it
// try {
// Class pclass = Class.forName(pname);
// InvocationProvider provider = (InvocationProvider)
// pclass.newInstance();
// invmgr.registerProvider(module, provider);
// Log.info("Registered provider [module=" + module +
// ", provider=" + pname + "].");
// } catch (Exception e) {
// Log.warning("Unable to register provider [module=" + module +
// ", provider=" + pname + ", error=" + e + "].");
// }
// }
// }
/**
* Returns the port on which the connection manager will listen for
* client connections.
*/
protected int getListenPort ()
{
return Client.DEFAULT_SERVER_PORT;
}
/**
* Starts up all of the server services and enters the main server
@@ -1,5 +1,5 @@
//
// $Id: ConnectionManager.java,v 1.21 2002/07/25 20:23:25 mdb Exp $
// $Id: ConnectionManager.java,v 1.22 2002/10/21 20:56:21 mdb Exp $
package com.threerings.presents.server.net;
@@ -21,7 +21,6 @@ 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;
/**
@@ -36,18 +35,11 @@ public class ConnectionManager extends LoopingThread
/**
* Constructs and initialized a connection manager (binding the socket
* on which it will listen for client connections).
*
* @param config A config object from which the connection manager
* will fetch its configuration parameters.
*/
public ConnectionManager ()
public ConnectionManager (int port)
throws IOException
{
// the listen port is specified in our configuration
_port = PresentsConfig.config.getValue(
CM_PORT_KEY, Client.DEFAULT_SERVER_PORT);
// we use this to wait for activity on our sockets
_port = port;
_selset = new SelectSet();
try {
@@ -378,9 +370,6 @@ public class ConnectionManager extends LoopingThread
protected ArrayList _observers = new ArrayList();
/** The config key for our listening port. */
protected static final String CM_PORT_KEY = "conmgr_port";
/**
* How long we wait for network events before checking our running
* flag to see if we should still be running.