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
@@ -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;