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:
@@ -1,15 +0,0 @@
|
||||
//
|
||||
// $Id: WhirledConfig.java,v 1.1 2002/03/28 22:32:33 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.server;
|
||||
|
||||
import com.samskivert.util.Config;
|
||||
|
||||
/**
|
||||
* Provides access to the Whirled server configuration.
|
||||
*/
|
||||
public class WhirledConfig
|
||||
{
|
||||
/** Provides access to configuration data for this package. */
|
||||
public static Config config = new Config("rsrc/config/whirled/server");
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
//
|
||||
// $Id: WhirledServer.java,v 1.14 2002/04/08 18:36:42 mdb Exp $
|
||||
// $Id: WhirledServer.java,v 1.15 2002/10/21 20:56:21 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.server;
|
||||
|
||||
import com.samskivert.jdbc.ConnectionProvider;
|
||||
import com.samskivert.jdbc.StaticConnectionProvider;
|
||||
|
||||
import com.threerings.crowd.server.CrowdServer;
|
||||
|
||||
import com.threerings.whirled.Log;
|
||||
@@ -13,14 +10,11 @@ import com.threerings.whirled.server.persist.SceneRepository;
|
||||
import com.threerings.whirled.server.persist.DummySceneRepository;
|
||||
|
||||
/**
|
||||
* The whirled server extends the crowd server and provides access to
|
||||
* managers and the like that are needed by the whirled serviecs.
|
||||
* The whirled server extends the {@link CrowdServer} and provides access
|
||||
* to managers and the like that are needed by the Whirled serviecs.
|
||||
*/
|
||||
public class WhirledServer extends CrowdServer
|
||||
{
|
||||
/** The database connection provider in use by this server. */
|
||||
public static ConnectionProvider conprov;
|
||||
|
||||
/** The scene registry. */
|
||||
public static SceneRegistry screg;
|
||||
|
||||
@@ -36,11 +30,8 @@ public class WhirledServer extends CrowdServer
|
||||
// configure the client to use our whirled client
|
||||
clmgr.setClientClass(WhirledClient.class);
|
||||
|
||||
// create our connection provider
|
||||
conprov = createConnectionProvider();
|
||||
|
||||
// create the scene repository
|
||||
_screp = createSceneRepository(conprov);
|
||||
_screp = createSceneRepository();
|
||||
|
||||
// create our scene registry
|
||||
screg = new SceneRegistry(invmgr, _screp);
|
||||
@@ -48,25 +39,6 @@ public class WhirledServer extends CrowdServer
|
||||
Log.info("Whirled server initialized.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the connection provider that will be used by this server.
|
||||
* If a derived class wishes to use a particular kind of connection
|
||||
* provider, it can override this method. The default mechanism is to
|
||||
* load a properties file referenced by <code>dbmap</code> in the
|
||||
* whirled server configuration and use those properties to create a
|
||||
* {@link StaticConnectionProvider}.
|
||||
*
|
||||
* @exception Exception thrown if an error occurs creating the
|
||||
* connection provider.
|
||||
*/
|
||||
protected ConnectionProvider createConnectionProvider ()
|
||||
throws Exception
|
||||
{
|
||||
String dbmap = WhirledConfig.config.getValue(DBMAP_KEY, DEF_DBMAP);
|
||||
Log.info("Configuring db connections via '" + dbmap + "'.");
|
||||
return new StaticConnectionProvider(dbmap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the scene repository that will be used by this server. If a
|
||||
* derived class wishes to use a particular kind of scene repository
|
||||
@@ -76,30 +48,12 @@ public class WhirledServer extends CrowdServer
|
||||
* @exception Exception thrown if any error occurs while instantiating
|
||||
* or initializing the scene repository.
|
||||
*/
|
||||
protected SceneRepository createSceneRepository (
|
||||
ConnectionProvider conprov)
|
||||
protected SceneRepository createSceneRepository ()
|
||||
throws Exception
|
||||
{
|
||||
return new DummySceneRepository();
|
||||
}
|
||||
|
||||
public static void main (String[] args)
|
||||
{
|
||||
WhirledServer server = new WhirledServer();
|
||||
try {
|
||||
server.init();
|
||||
server.run();
|
||||
} catch (Exception e) {
|
||||
Log.warning("Unable to initialize server.");
|
||||
Log.logStackTrace(e);
|
||||
}
|
||||
}
|
||||
|
||||
/** The scene repository in use by this server. */
|
||||
protected SceneRepository _screp;
|
||||
|
||||
// connection provider related configuration info
|
||||
protected final static String DBMAP_KEY = "dbmap";
|
||||
protected final static String DEF_DBMAP =
|
||||
"rsrc/config/whirled/dbmap";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user