Added support for loading place-related classes with a custom class

loader.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3255 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2004-11-30 20:04:11 +00:00
parent d29db7765a
commit 3ed8e3cd0e
2 changed files with 35 additions and 2 deletions
@@ -1,5 +1,5 @@
//
// $Id: LocationDirector.java,v 1.33 2004/08/27 02:12:32 mdb Exp $
// $Id$
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -274,6 +274,12 @@ public class LocationDirector extends BasicDirector
// make a note that we're now mostly in the new location
_placeId = placeId;
// check whether we should use a custom class loader
ClassLoader loader = getClassLoader(config);
if (loader != null) {
config.setClassLoader(loader);
}
Class cclass = config.getControllerClass();
try {
// start up a new place controller to manage the new place
@@ -554,6 +560,18 @@ public class LocationDirector extends BasicDirector
});
}
/**
* By overriding this method, it is possible to customize the location
* director to cause it to load the classes associated with a
* particular place via a custom class loader. That loader may enforce
* restricted privileges or obtain the classes from some special
* source.
*/
protected ClassLoader getClassLoader (PlaceConfig config)
{
return null;
}
/** The context through which we access needed services. */
protected CrowdContext _ctx;