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:
Michael Bayne
2002-03-28 22:32:34 +00:00
parent bf9a2ca151
commit b486315e47
31 changed files with 185 additions and 291 deletions
@@ -0,0 +1,15 @@
//
// $Id: CrowdConfig.java,v 1.1 2002/03/28 22:32:31 mdb Exp $
package com.threerings.crowd.server;
import com.samskivert.util.Config;
/**
* Provides access to the Crowd server configuration.
*/
public class CrowdConfig
{
/** Provides access to configuration data for this package. */
public static Config config = new Config("rsrc/config/crowd/server");
}
@@ -1,5 +1,5 @@
//
// $Id: CrowdServer.java,v 1.10 2002/03/05 05:33:25 mdb Exp $
// $Id: CrowdServer.java,v 1.11 2002/03/28 22:32:31 mdb Exp $
package com.threerings.crowd.server;
@@ -31,9 +31,6 @@ public class CrowdServer extends PresentsServer
// do the presents server initialization
super.init();
// bind the crowd server config into the namespace
config.bindProperties(CONFIG_KEY, CONFIG_PATH, true);
// configure the client manager to use our client
clmgr.setClientClass(CrowdClient.class);
@@ -41,10 +38,12 @@ public class CrowdServer extends PresentsServer
clmgr.setClientResolverClass(CrowdClientResolver.class);
// create our place registry
plreg = new PlaceRegistry(config, invmgr, omgr);
plreg = new PlaceRegistry(invmgr, omgr);
// register our invocation service providers
registerProviders(config.getValue(PROVIDERS_KEY, (String[])null));
String[] providers = null;
providers = CrowdConfig.config.getValue(PROVIDERS_KEY, providers);
registerProviders(providers);
Log.info("Crowd server initialized.");
}
@@ -74,10 +73,6 @@ public class CrowdServer extends PresentsServer
/** We use this to map usernames to body objects. */
protected static HashMap _bodymap = new HashMap();
// the path to the config file
protected final static String CONFIG_PATH =
"rsrc/config/crowd/server";
// the config key for our list of invocation provider mappings
protected final static String PROVIDERS_KEY = CONFIG_KEY + ".providers";
/** The config key for our list of invocation provider mappings. */
protected final static String PROVIDERS_KEY = "providers";
}
@@ -1,11 +1,10 @@
//
// $Id: PlaceRegistry.java,v 1.18 2001/12/14 00:11:17 mdb Exp $
// $Id: PlaceRegistry.java,v 1.19 2002/03/28 22:32:31 mdb Exp $
package com.threerings.crowd.server;
import java.util.Iterator;
import com.samskivert.util.Config;
import com.samskivert.util.HashIntMap;
import com.samskivert.util.Tuple;
import com.samskivert.util.Queue;
@@ -49,8 +48,7 @@ public class PlaceRegistry
* Creates and initializes the place registry; called by the server
* during its initialization phase.
*/
public PlaceRegistry (Config config, InvocationManager invmgr,
RootDObjectManager omgr)
public PlaceRegistry (InvocationManager invmgr, RootDObjectManager omgr)
{
// we'll need this later
_omgr = omgr;
@@ -1,5 +1,5 @@
//
// $Id: MiCasaClient.java,v 1.10 2002/02/26 05:48:11 mdb Exp $
// $Id: MiCasaClient.java,v 1.11 2002/03/28 22:32:31 mdb Exp $
package com.threerings.micasa.client;
@@ -9,8 +9,6 @@ import java.io.IOException;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import com.samskivert.util.Config;
import com.threerings.util.MessageManager;
import com.threerings.presents.client.Client;
@@ -97,7 +95,6 @@ public class MiCasaClient
throws IOException
{
// create the handles on our various services
_config = new Config();
_client = new Client(null, this);
// create our managers and directors
@@ -130,11 +127,6 @@ public class MiCasaClient
{
}
public Config getConfig ()
{
return _config;
}
public Client getClient ()
{
return _client;
@@ -180,7 +172,6 @@ public class MiCasaClient
protected MiCasaContext _ctx;
protected MiCasaFrame _frame;
protected Config _config;
protected Client _client;
protected LocationDirector _locdir;
protected OccupantManager _occmgr;
@@ -1,5 +1,5 @@
//
// $Id: LobbyRegistry.java,v 1.7 2001/10/22 23:56:42 mdb Exp $
// $Id: LobbyRegistry.java,v 1.8 2002/03/28 22:32:31 mdb Exp $
package com.threerings.micasa.lobby;
@@ -10,6 +10,7 @@ import com.threerings.presents.server.InvocationManager;
import com.threerings.crowd.data.BodyObject;
import com.threerings.micasa.Log;
import com.threerings.micasa.server.MiCasaConfig;
import com.threerings.micasa.server.MiCasaServer;
/**
@@ -72,16 +73,15 @@ public class LobbyRegistry implements LobbyCodes
* @param config the server configuration.
* @param invmgr a reference to the server's invocation manager.
*/
public void init (Config config, InvocationManager invmgr)
public void init (InvocationManager invmgr)
{
_config = config;
// register our invocation service handler
LobbyProvider provider = new LobbyProvider(this);
invmgr.registerProvider(MODULE_NAME, provider);
// create our lobby managers
String[] lmgrs = config.getValue(LOBIDS_KEY, (String[])null);
String[] lmgrs = null;
lmgrs = MiCasaConfig.config.getValue(LOBIDS_KEY, lmgrs);
if (lmgrs == null || lmgrs.length == 0) {
Log.warning("No lobbies specified in config file (via '" +
LOBIDS_KEY + "' parameter).");
@@ -109,9 +109,7 @@ public class LobbyRegistry implements LobbyCodes
{
try {
// extract the properties for this lobby
Properties props =
_config.getProperties(MiCasaServer.CONFIG_KEY);
props = PropertiesUtil.getSubProperties(props, lobbyId);
Properties props = MiCasaConfig.config.getSubProperties(lobbyId);
// get the lobby manager class and UGI
String cfgClass = props.getProperty("config");
@@ -216,10 +214,6 @@ public class LobbyRegistry implements LobbyCodes
", record=" + record + "].");
}
/** A reference to the server config object from which we loaded all
* of our configuration information. */
protected Config _config;
/** A table containing references to all of our lobby records (in the
* form of category lists. */
protected HashMap _lobbies = new HashMap();
@@ -0,0 +1,15 @@
//
// $Id: MiCasaConfig.java,v 1.1 2002/03/28 22:32:32 mdb Exp $
package com.threerings.micasa.server;
import com.samskivert.util.Config;
/**
* Provides access to the MiCasa server configuration.
*/
public class MiCasaConfig
{
/** Provides access to configuration data for this package. */
public static Config config = new Config("rsrc/config/micasa/server");
}
@@ -1,11 +1,10 @@
//
// $Id: MiCasaServer.java,v 1.4 2001/10/11 04:13:33 mdb Exp $
// $Id: MiCasaServer.java,v 1.5 2002/03/28 22:32:32 mdb Exp $
package com.threerings.micasa.server;
import com.samskivert.jdbc.ConnectionProvider;
import com.samskivert.jdbc.StaticConnectionProvider;
import com.samskivert.util.Config;
import com.threerings.crowd.server.CrowdServer;
import com.threerings.parlor.server.ParlorManager;
@@ -19,9 +18,6 @@ import com.threerings.micasa.lobby.LobbyRegistry;
*/
public class MiCasaServer extends CrowdServer
{
/** The namespace used for server config properties. */
public static final String CONFIG_KEY = "micasa";
/** The database connection provider in use by this server. */
public static ConnectionProvider conprov;
@@ -43,17 +39,14 @@ public class MiCasaServer extends CrowdServer
// configure the client manager to use our client class
clmgr.setClientClass(MiCasaClient.class);
// bind the whirled server config into the namespace
config.bindProperties(CONFIG_KEY, CONFIG_PATH, true);
// initialize our parlor manager
parmgr.init(config, invmgr);
parmgr.init(invmgr);
// initialize the lobby registry
lobreg.init(config, invmgr);
lobreg.init(invmgr);
// create our connection provider
String dbmap = config.getValue(DBMAP_KEY, DEF_DBMAP);
String dbmap = MiCasaConfig.config.getValue(DBMAP_KEY, DEF_DBMAP);
conprov = new StaticConnectionProvider(dbmap);
Log.info("MiCasa server initialized.");
@@ -71,12 +64,8 @@ public class MiCasaServer extends CrowdServer
}
}
// the path to the config file
protected final static String CONFIG_PATH =
"rsrc/config/micasa/server";
// connection provider related configuration info
protected final static String DBMAP_KEY = CONFIG_KEY + ".dbmap";
protected final static String DBMAP_KEY = "dbmap";
protected final static String DEF_DBMAP =
"rsrc/config/micasa/dbmap.properties";
}
@@ -1,5 +1,5 @@
//
// $Id: SimpleClient.java,v 1.2 2002/02/05 22:58:23 mdb Exp $
// $Id: SimpleClient.java,v 1.3 2002/03/28 22:32:32 mdb Exp $
package com.threerings.micasa.simulator.client;
@@ -11,8 +11,6 @@ import java.io.IOException;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import com.samskivert.util.Config;
import com.threerings.presents.client.Client;
import com.threerings.presents.dobj.DObjectManager;
@@ -36,7 +34,6 @@ public class SimpleClient
_ctx = new ParlorContextImpl();
// create the handles on our various services
_config = new Config();
_client = new Client(null, this);
// create our managers and directors
@@ -83,11 +80,6 @@ public class SimpleClient
*/
protected class ParlorContextImpl implements ParlorContext
{
public Config getConfig ()
{
return _config;
}
public Client getClient ()
{
return _client;
@@ -123,7 +115,6 @@ public class SimpleClient
protected ParlorContext _ctx;
protected SimulatorFrame _frame;
protected Config _config;
protected Client _client;
protected LocationDirector _locdir;
protected OccupantManager _occmgr;
@@ -1,5 +1,5 @@
//
// $Id: SimpleServer.java,v 1.3 2002/03/05 05:33:25 mdb Exp $
// $Id: SimpleServer.java,v 1.4 2002/03/28 22:32:32 mdb Exp $
package com.threerings.micasa.simulator.server;
@@ -21,6 +21,6 @@ public class SimpleServer extends CrowdServer
// create the simulator manager
SimulatorManager simmgr = new SimulatorManager();
simmgr.init(config, invmgr, plreg, clmgr, omgr, this);
simmgr.init(invmgr, plreg, clmgr, omgr, this);
}
}
@@ -1,12 +1,10 @@
//
// $Id: SimulatorManager.java,v 1.8 2002/03/26 01:30:37 shaper Exp $
// $Id: SimulatorManager.java,v 1.9 2002/03/28 22:32:32 mdb Exp $
package com.threerings.micasa.simulator.server;
import java.util.ArrayList;
import com.samskivert.util.Config;
import com.threerings.presents.data.ClientObject;
import com.threerings.presents.dobj.RootDObjectManager;
import com.threerings.presents.server.ClientManager;
@@ -41,13 +39,12 @@ public class SimulatorManager
* the server that is making use of the simulator services on the
* single instance of simulator manager that it has created.
*
* @param config the configuration object in use by this server.
* @param invmgr a reference to the invocation manager in use by this
* server.
*/
public void init (Config config, InvocationManager invmgr,
PlaceRegistry plreg, ClientManager clmgr,
RootDObjectManager omgr, SimulatorServer simserv)
public void init (InvocationManager invmgr, PlaceRegistry plreg,
ClientManager clmgr, RootDObjectManager omgr,
SimulatorServer simserv)
{
// register our simulator provider
SimulatorProvider sprov = new SimulatorProvider(this);
@@ -0,0 +1,15 @@
//
// $Id: MisoConfig.java,v 1.1 2002/03/28 22:32:32 mdb Exp $
package com.threerings.miso;
import com.samskivert.util.Config;
/**
* Provides access to the Miso configuration.
*/
public class MisoConfig
{
/** Provides access to configuration data for this package. */
public static Config config = new Config("rsrc/config/miso/miso");
}
@@ -1,5 +1,5 @@
//
// $Id: IsoSceneViewModel.java,v 1.22 2002/02/18 06:06:14 mdb Exp $
// $Id: IsoSceneViewModel.java,v 1.23 2002/03/28 22:32:32 mdb Exp $
package com.threerings.miso.scene;
@@ -7,11 +7,9 @@ import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
import com.samskivert.util.Config;
import com.threerings.miso.Log;
import com.threerings.miso.MisoConfig;
import com.threerings.miso.scene.util.IsoUtil;
import com.threerings.miso.util.MisoUtil;
/**
* Provides a holding place for the myriad parameters and bits of data
@@ -19,7 +17,7 @@ import com.threerings.miso.util.MisoUtil;
*
* <p> The member data are public to facilitate speedy referencing by the
* {@link IsoSceneView} class. The model should only be modified through
* the constructor's passed-in {@link Config} object and the accessor
* the configuration data provided via {@link MisoConfig} and the accessor
* methods.
*/
public class IsoSceneViewModel
@@ -81,29 +79,34 @@ public class IsoSceneViewModel
*
* @param config the config object.
*/
public IsoSceneViewModel (Config config)
public IsoSceneViewModel ()
{
// set the scene tile dimensions
scenewid = config.getValue(SCENE_WIDTH_KEY, DEF_SCENE_WIDTH);
scenehei = config.getValue(SCENE_HEIGHT_KEY, DEF_SCENE_HEIGHT);
scenewid = MisoConfig.config.getValue(
SCENE_WIDTH_KEY, DEF_SCENE_WIDTH);
scenehei = MisoConfig.config.getValue(
SCENE_HEIGHT_KEY, DEF_SCENE_HEIGHT);
// get the tile dimensions
tilewid = config.getValue(TILE_WIDTH_KEY, DEF_TILE_WIDTH);
tilehei = config.getValue(TILE_HEIGHT_KEY, DEF_TILE_HEIGHT);
tilewid = MisoConfig.config.getValue(TILE_WIDTH_KEY, DEF_TILE_WIDTH);
tilehei = MisoConfig.config.getValue(TILE_HEIGHT_KEY, DEF_TILE_HEIGHT);
// set the fine coordinate granularity
finegran = config.getValue(FINE_GRAN_KEY, DEF_FINE_GRAN);
finegran = MisoConfig.config.getValue(FINE_GRAN_KEY, DEF_FINE_GRAN);
// set our various flags
showCoords = config.getValue(SHOW_COORDS_KEY, DEF_SHOW_COORDS);
showPaths = config.getValue(SHOW_PATHS_KEY, DEF_SHOW_PATHS);
showFootprints = config.getValue(SHOW_FOOTPRINTS_KEY,
DEF_SHOW_FOOTPRINTS);
showCoords = MisoConfig.config.getValue(
SHOW_COORDS_KEY, DEF_SHOW_COORDS);
showPaths = MisoConfig.config.getValue(SHOW_PATHS_KEY, DEF_SHOW_PATHS);
showFootprints = MisoConfig.config.getValue(
SHOW_FOOTPRINTS_KEY, DEF_SHOW_FOOTPRINTS);
// precalculate various things
int svwid = config.getValue(SCENE_VWIDTH_KEY, DEF_SCENE_VWIDTH);
int svhei = config.getValue(SCENE_VHEIGHT_KEY, DEF_SCENE_VHEIGHT);
int offy = config.getValue(SCENE_OFFSET_Y_KEY, DEF_OFFSET_Y);
int svwid = MisoConfig.config.getValue(
SCENE_VWIDTH_KEY, DEF_SCENE_VWIDTH);
int svhei = MisoConfig.config.getValue(
SCENE_VHEIGHT_KEY, DEF_SCENE_VHEIGHT);
int offy = MisoConfig.config.getValue(SCENE_OFFSET_Y_KEY, DEF_OFFSET_Y);
precalculate(svwid, svhei, offy);
}
@@ -266,48 +269,37 @@ public class IsoSceneViewModel
}
/** The config key for tile width in pixels. */
protected static final String TILE_WIDTH_KEY =
MisoUtil.CONFIG_KEY + ".tile_width";
protected static final String TILE_WIDTH_KEY = "tile_width";
/** The config key for tile height in pixels. */
protected static final String TILE_HEIGHT_KEY =
MisoUtil.CONFIG_KEY + ".tile_height";
protected static final String TILE_HEIGHT_KEY = "tile_height";
/** The config key for tile fine coordinate granularity. */
protected static final String FINE_GRAN_KEY =
MisoUtil.CONFIG_KEY + ".fine_granularity";
protected static final String FINE_GRAN_KEY = "fine_granularity";
/** The config key for scene view width in tile count. */
protected static final String SCENE_VWIDTH_KEY =
MisoUtil.CONFIG_KEY + ".scene_view_width";
protected static final String SCENE_VWIDTH_KEY = "scene_view_width";
/** The config key for scene view height in tile count. */
protected static final String SCENE_VHEIGHT_KEY =
MisoUtil.CONFIG_KEY + ".scene_view_height";
protected static final String SCENE_VHEIGHT_KEY = "scene_view_height";
/** The config key for scene width in tile count. */
protected static final String SCENE_WIDTH_KEY =
MisoUtil.CONFIG_KEY + ".scene_width";
protected static final String SCENE_WIDTH_KEY = "scene_width";
/** The config key for scene height in tile count. */
protected static final String SCENE_HEIGHT_KEY =
MisoUtil.CONFIG_KEY + ".scene_height";
protected static final String SCENE_HEIGHT_KEY = "scene_height";
/** The config key for scene origin vertical offset in tile count. */
protected static final String SCENE_OFFSET_Y_KEY =
MisoUtil.CONFIG_KEY + ".scene_offset_y";
protected static final String SCENE_OFFSET_Y_KEY = "scene_offset_y";
/** The config key for whether to show tile coordinates. */
protected static final String SHOW_COORDS_KEY =
MisoUtil.CONFIG_KEY + ".show_coords";
protected static final String SHOW_COORDS_KEY = "show_coords";
/** The config key for whether to show sprite paths. */
protected static final String SHOW_PATHS_KEY =
MisoUtil.CONFIG_KEY + ".show_paths";
protected static final String SHOW_PATHS_KEY = "show_paths";
/** The config key for whether to show object tile footprints. */
protected static final String SHOW_FOOTPRINTS_KEY =
MisoUtil.CONFIG_KEY + ".show_footprints";
protected static final String SHOW_FOOTPRINTS_KEY = "show_footprints";
/** Default scene view parameters. */
protected static final int DEF_TILE_WIDTH = 64;
@@ -1,5 +1,5 @@
//
// $Id: SceneViewPanel.java,v 1.36 2002/02/21 06:01:29 mdb Exp $
// $Id: SceneViewPanel.java,v 1.37 2002/03/28 22:32:32 mdb Exp $
package com.threerings.miso.scene;
@@ -18,7 +18,6 @@ import com.threerings.media.animation.AnimationManager;
import com.threerings.media.sprite.SpriteManager;
import com.threerings.miso.Log;
import com.threerings.miso.util.MisoUtil;
import com.threerings.miso.scene.util.IsoUtil;
/**
@@ -1,18 +1,19 @@
//
// $Id: MisoContext.java,v 1.7 2001/11/18 04:09:23 mdb Exp $
// $Id: MisoContext.java,v 1.8 2002/03/28 22:32:32 mdb Exp $
package com.threerings.miso.util;
import com.samskivert.util.Context;
import com.threerings.media.ImageManager;
import com.threerings.media.tile.TileManager;
public interface MisoContext extends Context
/**
* Provides Miso code with access to the managers that it needs to do its
* thing.
*/
public interface MisoContext
{
/**
* Returns a reference to the tile manager. This reference is
* valid for the lifetime of the application.
* Returns a reference to the tile manager. This reference is valid
* for the lifetime of the application.
*/
public TileManager getTileManager ();
}
@@ -1,29 +0,0 @@
//
// $Id: MisoUtil.java,v 1.16 2001/11/29 00:19:03 mdb Exp $
package com.threerings.miso.util;
import java.io.IOException;
import com.samskivert.util.Config;
import com.threerings.miso.Log;
/**
* The miso util class provides miscellaneous routines for
* applications or other layers that intend to make use of Miso
* services.
*/
public class MisoUtil
{
/** The config key prefix for miso properties. */
public static final String CONFIG_KEY = "miso";
/**
* Populates the config object with miso configuration values.
*
* @param config the <code>Config</code> object to populate.
*/
public static void bindProperties (Config config) throws IOException
{
config.bindProperties(CONFIG_KEY, "rsrc/config/miso/miso");
}
}
@@ -1,9 +1,8 @@
//
// $Id: ParlorManager.java,v 1.16 2002/02/20 02:10:02 shaper Exp $
// $Id: ParlorManager.java,v 1.17 2002/03/28 22:32:32 mdb Exp $
package com.threerings.parlor.server;
import com.samskivert.util.Config;
import com.samskivert.util.HashIntMap;
import com.threerings.presents.server.InvocationManager;
@@ -32,11 +31,10 @@ public class ParlorManager
* that is making use of the parlor services on the single instance of
* parlor manager that it has created.
*
* @param config the configuration object in use by this server.
* @param invmgr a reference to the invocation manager in use by this
* server.
*/
public void init (Config config, InvocationManager invmgr)
public void init (InvocationManager invmgr)
{
// register our invocation provider
ParlorProvider pprov = new ParlorProvider(this);
@@ -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
@@ -0,0 +1,15 @@
//
// $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,10 @@
//
// $Id: WhirledServer.java,v 1.12 2002/03/05 03:19:18 mdb Exp $
// $Id: WhirledServer.java,v 1.13 2002/03/28 22:32:33 mdb Exp $
package com.threerings.whirled.server;
import com.samskivert.jdbc.ConnectionProvider;
import com.samskivert.jdbc.StaticConnectionProvider;
import com.samskivert.util.Config;
import com.threerings.crowd.server.CrowdServer;
@@ -19,9 +18,6 @@ import com.threerings.whirled.server.persist.DummySceneRepository;
*/
public class WhirledServer extends CrowdServer
{
/** The namespace used for server config properties. */
public static final String CONFIG_KEY = "whirled";
/** The database connection provider in use by this server. */
public static ConnectionProvider conprov;
@@ -37,14 +33,11 @@ public class WhirledServer extends CrowdServer
// do the base server initialization
super.init();
// bind the whirled server config into the namespace
config.bindProperties(CONFIG_KEY, CONFIG_PATH, true);
// configure the client to use our whirled client
clmgr.setClientClass(WhirledClient.class);
// create our connection provider
conprov = createConnectionProvider(config);
conprov = createConnectionProvider();
// create the scene repository
_screp = createSceneRepository(conprov);
@@ -52,9 +45,6 @@ public class WhirledServer extends CrowdServer
// create our scene registry
screg = new SceneRegistry(invmgr, _screp);
// register our invocation service providers
registerProviders(config.getValue(PROVIDERS_KEY, (String[])null));
Log.info("Whirled server initialized.");
}
@@ -69,10 +59,10 @@ public class WhirledServer extends CrowdServer
* @exception Exception thrown if an error occurs creating the
* connection provider.
*/
protected ConnectionProvider createConnectionProvider (Config config)
protected ConnectionProvider createConnectionProvider ()
throws Exception
{
String dbmap = config.getValue(DBMAP_KEY, DEF_DBMAP);
String dbmap = WhirledConfig.config.getValue(DBMAP_KEY, DEF_DBMAP);
return new StaticConnectionProvider(dbmap);
}
@@ -107,15 +97,8 @@ public class WhirledServer extends CrowdServer
/** The scene repository in use by this server. */
protected SceneRepository _screp;
// the path to the config file
protected final static String CONFIG_PATH =
"rsrc/config/whirled/server";
// the config key for our list of invocation provider mappings
protected final static String PROVIDERS_KEY = CONFIG_KEY + ".providers";
// connection provider related configuration info
protected final static String DBMAP_KEY = CONFIG_KEY + ".dbmap";
protected final static String DBMAP_KEY = "dbmap";
protected final static String DEF_DBMAP =
"rsrc/config/whirled/dbmap";
}
@@ -1,12 +1,11 @@
//
// $Id: TestApp.java,v 1.11 2002/01/16 03:01:24 mdb Exp $
// $Id: TestApp.java,v 1.12 2002/03/28 22:32:33 mdb Exp $
package com.threerings.cast.builder;
import java.io.IOException;
import javax.swing.JFrame;
import com.samskivert.util.Config;
import com.samskivert.swing.util.SwingUtil;
import com.threerings.resource.ResourceManager;
@@ -18,7 +17,6 @@ import com.threerings.cast.ComponentRepository;
import com.threerings.cast.bundle.BundledComponentRepository;
import com.threerings.miso.scene.MisoCharacterSprite;
import com.threerings.miso.util.MisoUtil;
public class TestApp
{
@@ -29,10 +27,6 @@ public class TestApp
_frame.setSize(800, 600);
SwingUtil.centerWindow(_frame);
// create the handles on our various services
_config = new Config();
MisoUtil.bindProperties(_config);
ResourceManager rmgr = new ResourceManager(
"rsrc", null, "config/resource/manager.properties");
ImageManager imgr = new ImageManager(rmgr, _frame);
@@ -65,7 +59,4 @@ public class TestApp
/** The test frame. */
protected JFrame _frame;
/** The config object. */
protected Config _config;
}
@@ -1,9 +1,8 @@
//
// $Id: TestClient.java,v 1.8 2002/02/09 20:47:11 mdb Exp $
// $Id: TestClient.java,v 1.9 2002/03/28 22:32:33 mdb Exp $
package com.threerings.crowd.client;
import com.samskivert.util.Config;
import com.samskivert.util.Queue;
import com.threerings.presents.client.*;
@@ -22,7 +21,6 @@ public class TestClient
_ctx = new CrowdContextImpl();
// create the handles on our various services
_config = new Config();
_client = new Client(creds, this);
_locdir = new LocationDirector(_ctx);
_occmgr = new OccupantManager(_ctx);
@@ -96,11 +94,6 @@ public class TestClient
protected class CrowdContextImpl implements CrowdContext
{
public Config getConfig ()
{
return _config;
}
public Client getClient ()
{
return _client;
@@ -127,7 +120,6 @@ public class TestClient
}
}
protected Config _config;
protected Client _client;
protected LocationDirector _locdir;
protected OccupantManager _occmgr;
@@ -1,5 +1,5 @@
//
// $Id: ScrollingTestApp.java,v 1.7 2002/03/08 22:37:50 mdb Exp $
// $Id: ScrollingTestApp.java,v 1.8 2002/03/28 22:32:33 mdb Exp $
package com.threerings.miso.scene;
@@ -32,8 +32,8 @@ import com.threerings.cast.NoSuchComponentException;
import com.threerings.cast.bundle.BundledComponentRepository;
import com.threerings.miso.Log;
import com.threerings.miso.MisoConfig;
import com.threerings.miso.util.MisoContext;
import com.threerings.miso.util.MisoUtil;
/**
* Tests the scrolling capabilities of the IsoSceneView.
@@ -68,7 +68,6 @@ public class ScrollingTestApp
_frame = new ScrollingFrame(gc);
// we don't need to configure anything
_config = new Config();
ResourceManager rmgr = new ResourceManager(
"rsrc", null, "config/resource/manager.properties");
ImageManager imgr = new ImageManager(rmgr, _frame);
@@ -76,8 +75,8 @@ public class ScrollingTestApp
_tilemgr.setTileSetRepository(
new BundledTileSetRepository(rmgr, imgr, "tilesets"));
// bind our miso properties
_config.bindProperties("miso", "rsrc/config/miso/scrolling");
// hack in some different MisoProperties
MisoConfig.config = new Config("rsrc/config/miso/scrolling");
// create the context object
MisoContext ctx = new ContextImpl();
@@ -89,7 +88,7 @@ public class ScrollingTestApp
charmgr.setCharacterClass(MisoCharacterSprite.class);
// create our scene view panel
_panel = new SceneViewPanel(new IsoSceneViewModel(_config));
_panel = new SceneViewPanel(new IsoSceneViewModel());
_frame.setPanel(_panel);
// create our "ship" sprite
@@ -139,16 +138,10 @@ public class ScrollingTestApp
/**
* The implementation of the MisoContext interface that provides
* handles to the config and manager objects that offer commonly used
* services.
* handles to the manager objects that offer commonly used services.
*/
protected class ContextImpl implements MisoContext
{
public Config getConfig ()
{
return _config;
}
public TileManager getTileManager ()
{
return _tilemgr;
@@ -178,9 +171,6 @@ public class ScrollingTestApp
}
}
/** The config object. */
protected Config _config;
/** The tile manager object. */
protected TileManager _tilemgr;
@@ -1,5 +1,5 @@
//
// $Id: ViewerApp.java,v 1.27 2002/02/19 07:43:20 mdb Exp $
// $Id: ViewerApp.java,v 1.28 2002/03/28 22:32:33 mdb Exp $
package com.threerings.miso.viewer;
@@ -10,7 +10,6 @@ import java.awt.GraphicsEnvironment;
import java.io.IOException;
import com.samskivert.swing.util.SwingUtil;
import com.samskivert.util.Config;
import com.threerings.resource.ResourceManager;
import com.threerings.media.ImageManager;
@@ -27,7 +26,6 @@ import com.threerings.miso.scene.MisoCharacterSprite;
import com.threerings.miso.scene.MisoSceneModel;
import com.threerings.miso.scene.tools.xml.MisoSceneParser;
import com.threerings.miso.util.MisoContext;
import com.threerings.miso.util.MisoUtil;
/**
* The ViewerApp is a scene viewing application that allows for trying
@@ -68,7 +66,6 @@ public class ViewerApp
_frame = new ViewerFrame(gc);
// we don't need to configure anything
_config = new Config();
ResourceManager rmgr = new ResourceManager(
"rsrc", null, "config/resource/manager.properties");
ImageManager imgr = new ImageManager(rmgr, _frame);
@@ -76,9 +73,6 @@ public class ViewerApp
_tilemgr.setTileSetRepository(
new BundledTileSetRepository(rmgr, imgr, "tilesets"));
// bind our miso properties
MisoUtil.bindProperties(_config);
// create the context object
MisoContext ctx = new ContextImpl();
@@ -129,11 +123,6 @@ public class ViewerApp
*/
protected class ContextImpl implements MisoContext
{
public Config getConfig ()
{
return _config;
}
public TileManager getTileManager ()
{
return _tilemgr;
@@ -163,9 +152,6 @@ public class ViewerApp
}
}
/** The config object. */
protected Config _config;
/** The tile manager object. */
protected TileManager _tilemgr;
@@ -1,5 +1,5 @@
//
// $Id: ViewerSceneViewPanel.java,v 1.44 2002/03/27 21:49:11 mdb Exp $
// $Id: ViewerSceneViewPanel.java,v 1.45 2002/03/28 22:32:33 mdb Exp $
package com.threerings.miso.viewer;
@@ -45,7 +45,7 @@ public class ViewerSceneViewPanel extends SceneViewPanel
CharacterManager charmgr,
ComponentRepository crepo)
{
super(new IsoSceneViewModel(ctx.getConfig()));
super(new IsoSceneViewModel());
// create the character descriptors
_descUser = CastUtil.getRandomDescriptor("female", crepo);
@@ -1,9 +1,8 @@
//
// $Id: TestClient.java,v 1.6 2002/02/09 20:47:11 mdb Exp $
// $Id: TestClient.java,v 1.7 2002/03/28 22:32:33 mdb Exp $
package com.threerings.parlor;
import com.samskivert.util.Config;
import com.samskivert.util.Queue;
import com.threerings.presents.client.*;
@@ -28,7 +27,6 @@ public class TestClient
_ctx = new ParlorContextImpl();
// create the handles on our various services
_config = new Config();
_client = new Client(creds, this);
_locdir = new LocationDirector(_ctx);
_occmgr = new OccupantManager(_ctx);
@@ -146,11 +144,6 @@ public class TestClient
protected class ParlorContextImpl implements ParlorContext
{
public Config getConfig ()
{
return _config;
}
public Client getClient ()
{
return _client;
@@ -182,7 +175,6 @@ public class TestClient
}
}
protected Config _config;
protected Client _client;
protected LocationDirector _locdir;
protected OccupantManager _occmgr;
@@ -1,5 +1,5 @@
//
// $Id: TestServer.java,v 1.3 2001/11/08 02:07:36 mdb Exp $
// $Id: TestServer.java,v 1.4 2002/03/28 22:32:33 mdb Exp $
package com.threerings.parlor;
@@ -23,7 +23,7 @@ public class TestServer extends CrowdServer
super.init();
// initialize our parlor manager
parmgr.init(config, invmgr);
parmgr.init(invmgr);
Log.info("Parlor server initialized.");
}
@@ -1,5 +1,5 @@
//
// $Id: TestServer.java,v 1.7 2001/11/08 02:07:36 mdb Exp $
// $Id: TestServer.java,v 1.8 2002/03/28 22:32:33 mdb Exp $
package com.threerings.presents.server;
@@ -8,9 +8,6 @@ import com.threerings.presents.dobj.*;
public class TestServer extends PresentsServer
{
/** The namespace used for server config properties. */
public static final String CONFIG_KEY = "test";
public static TestObject testobj;
public void init ()
@@ -18,12 +15,6 @@ public class TestServer extends PresentsServer
{
super.init();
// bind the crowd server config into the namespace
config.bindProperties(CONFIG_KEY, CONFIG_PATH, true);
// register our invocation service providers
registerProviders(config.getValue(PROVIDERS_KEY, (String[])null));
// create a test object
Subscriber sub = new Subscriber()
{
@@ -52,11 +43,4 @@ public class TestServer extends PresentsServer
Log.logStackTrace(e);
}
}
// the path to the config file
protected final static String CONFIG_PATH =
"rsrc/config/presents/test/server";
// the config key for our list of invocation provider mappings
protected final static String PROVIDERS_KEY = CONFIG_KEY + ".providers";
}
@@ -1,9 +1,8 @@
//
// $Id: TestClient.java,v 1.10 2002/02/09 20:47:11 mdb Exp $
// $Id: TestClient.java,v 1.11 2002/03/28 22:32:34 mdb Exp $
package com.threerings.whirled;
import com.samskivert.util.Config;
import com.samskivert.util.Queue;
import com.threerings.presents.client.*;
@@ -28,7 +27,6 @@ public class TestClient
_ctx = new WhirledContextImpl();
// create the handles for our various services
_config = new Config();
_client = new Client(creds, this);
_screp = new DummyClientSceneRepository();
_occmgr = new OccupantManager(_ctx);
@@ -126,11 +124,6 @@ public class TestClient
protected class WhirledContextImpl implements WhirledContext
{
public Config getConfig ()
{
return _config;
}
public Client getClient ()
{
return _client;
@@ -162,7 +155,6 @@ public class TestClient
}
}
protected Config _config;
protected Client _client;
protected LocationDirector _locdir;
protected SceneDirector _scdir;