diff --git a/src/java/com/threerings/stage/server/StageSceneManager.java b/src/java/com/threerings/stage/server/StageSceneManager.java
index f9da1afb..794a1e81 100644
--- a/src/java/com/threerings/stage/server/StageSceneManager.java
+++ b/src/java/com/threerings/stage/server/StageSceneManager.java
@@ -205,9 +205,9 @@ public class StageSceneManager extends SpotSceneManager
}
@Override // documentation inherited
- protected void gotSceneData ()
+ protected void gotSceneData (Object extras)
{
- super.gotSceneData();
+ super.gotSceneData(extras);
// cast some scene related bits
_sscene = (StageScene)_scene;
diff --git a/src/java/com/threerings/whirled/server/SceneManager.java b/src/java/com/threerings/whirled/server/SceneManager.java
index b713ae4a..55dab37c 100644
--- a/src/java/com/threerings/whirled/server/SceneManager.java
+++ b/src/java/com/threerings/whirled/server/SceneManager.java
@@ -83,7 +83,7 @@ public class SceneManager extends PlaceManager
* Called by the scene registry once the scene manager has been created (and initialized), but
* before it is started up.
*/
- protected void setSceneData (Scene scene, UpdateList updates, SceneRegistry screg)
+ protected void setSceneData (Scene scene, UpdateList updates, Object extras, SceneRegistry screg)
{
_scene = scene;
_screg = screg;
@@ -99,15 +99,18 @@ public class SceneManager extends PlaceManager
}
// let derived classes react to the receipt of scene data
- gotSceneData();
+ gotSceneData(extras);
}
/**
* A method that can be overridden by derived classes to perform initialization processing
* after we receive our scene information but before we're started up (and hence registered as
* an active place).
+ *
+ * @param extras optional additional information supplied by the repository when the scene was
+ * loaded, or null if the repository provided no extras.
*/
- protected void gotSceneData ()
+ protected void gotSceneData (Object extras)
{
}
diff --git a/src/java/com/threerings/whirled/server/SceneRegistry.java b/src/java/com/threerings/whirled/server/SceneRegistry.java
index f65cf781..21ac9520 100644
--- a/src/java/com/threerings/whirled/server/SceneRegistry.java
+++ b/src/java/com/threerings/whirled/server/SceneRegistry.java
@@ -168,21 +168,20 @@ public class SceneRegistry
// otherwise we have to load the scene from the repository
final int fsceneId = sceneId;
_invoker.postUnit(new RepositoryUnit("resolveScene(" + sceneId + ")") {
- @Override
- public void invokePersist () throws Exception {
+ @Override public void invokePersist () throws Exception {
_model = _screp.loadSceneModel(fsceneId);
_updates = _screp.loadUpdates(fsceneId);
+ _extras = _screp.loadExtras(fsceneId);
}
- @Override
- public void handleSuccess () {
- processSuccessfulResolution(_model, _updates);
+ @Override public void handleSuccess () {
+ processSuccessfulResolution(_model, _updates, _extras);
}
- @Override
- public void handleFailure (Exception error) {
+ @Override public void handleFailure (Exception error) {
processFailedResolution(fsceneId, error);
}
protected SceneModel _model;
protected UpdateList _updates;
+ protected Object _extras;
});
}
@@ -240,7 +239,8 @@ public class SceneRegistry
/**
* Called when the scene resolution has completed successfully.
*/
- protected void processSuccessfulResolution (SceneModel model, final UpdateList updates)
+ protected void processSuccessfulResolution (
+ SceneModel model, final UpdateList updates, final Object extras)
{
// now that the scene is loaded, we can create a scene manager for it. that will be
// initialized by the place registry and when that is finally complete, then we can let our
@@ -253,7 +253,7 @@ public class SceneRegistry
// now create our scene manager
_plreg.createPlace(scene.getPlaceConfig(), new PlaceRegistry.PreStartupHook() {
public void invoke (PlaceManager pmgr) {
- ((SceneManager)pmgr).setSceneData(scene, updates, SceneRegistry.this);
+ ((SceneManager)pmgr).setSceneData(scene, updates, extras, SceneRegistry.this);
}
});
diff --git a/src/java/com/threerings/whirled/server/persist/DummySceneRepository.java b/src/java/com/threerings/whirled/server/persist/DummySceneRepository.java
index 4fa3bf1b..a9454ea9 100644
--- a/src/java/com/threerings/whirled/server/persist/DummySceneRepository.java
+++ b/src/java/com/threerings/whirled/server/persist/DummySceneRepository.java
@@ -47,11 +47,18 @@ public class DummySceneRepository implements SceneRepository
// documentation inherited from interface
public UpdateList loadUpdates (int sceneId)
- throws PersistenceException, NoSuchSceneException
+ throws PersistenceException
{
return new UpdateList();
}
+ // documentation inherited from interface
+ public Object loadExtras (int sceneId)
+ throws PersistenceException
+ {
+ return null;
+ }
+
// documentation inherited from interface
public void applyAndRecordUpdate (SceneModel model, SceneUpdate update)
throws PersistenceException
diff --git a/src/java/com/threerings/whirled/server/persist/SceneRepository.java b/src/java/com/threerings/whirled/server/persist/SceneRepository.java
index 5efde3cd..98eedf24 100644
--- a/src/java/com/threerings/whirled/server/persist/SceneRepository.java
+++ b/src/java/com/threerings/whirled/server/persist/SceneRepository.java
@@ -29,21 +29,18 @@ import com.threerings.whirled.util.NoSuchSceneException;
import com.threerings.whirled.util.UpdateList;
/**
- * The scene repository provides the basic interface for loading and
- * updating scene data. It is used by the scene registry and though more
- * scene related persistence services may be needed in a full-fledged
- * application, the scene repository only encapsulates those needed by the
- * scene registry and other services provided by the Whirled framework.
+ * The scene repository provides the basic interface for loading and updating scene data. It is
+ * used by the scene registry and though more scene related persistence services may be needed in a
+ * full-fledged application, the scene repository only encapsulates those needed by the scene
+ * registry and other services provided by the Whirled framework.
*/
public interface SceneRepository
{
/**
* Fetches the model for the scene with the specified scene id.
*
- * @exception PersistenceException thrown if an error occurs
- * attempting to load the scene data.
- * @exception NoSuchSceneException thrown if no scene exists with the
- * specified scene id.
+ * @exception PersistenceException thrown if an error occurs attempting to load the scene data.
+ * @exception NoSuchSceneException thrown if no scene exists with the specified scene id.
*/
public SceneModel loadSceneModel (int sceneId)
throws PersistenceException, NoSuchSceneException;
@@ -51,22 +48,26 @@ public interface SceneRepository
/**
* Fetches the set of updates associated with the specified scene.
*
- * @exception PersistenceException thrown if an error occurs
- * attempting to load the scene updates.
- * @exception NoSuchSceneException thrown if no scene exists with the
- * specified scene id.
+ * @exception PersistenceException thrown if an error occurs attempting to load the scene
+ * updates.
*/
public UpdateList loadUpdates (int sceneId)
- throws PersistenceException, NoSuchSceneException;
+ throws PersistenceException;
/**
- * Applise the supplied scene update to persistent representation of
- * its associated scene, then stores the update persistently for
- * future invocations of the server to load. Note: the scene
- * update will have already been applied to the supplied scene model.
+ * Loads optional additional scene data. This data is loaded during the scene resolution
+ * process and made available to the scene manager via {@link SceneManager#gotSceneData}.
+ */
+ public Object loadExtras (int sceneId)
+ throws PersistenceException;
+
+ /**
+ * Applise the supplied scene update to persistent representation of its associated scene, then
+ * stores the update persistently for future invocations of the server to load. Note:
+ * the scene update will have already been applied to the supplied scene model.
*
- * @exception PersistenceException thrown if an error occurs
- * attempting to apply the scene update.
+ * @exception PersistenceException thrown if an error occurs attempting to apply the scene
+ * update.
*/
public void applyAndRecordUpdate (SceneModel model, SceneUpdate update)
throws PersistenceException;
diff --git a/src/java/com/threerings/whirled/spot/server/SpotSceneManager.java b/src/java/com/threerings/whirled/spot/server/SpotSceneManager.java
index 03b8c8e3..57e4347d 100644
--- a/src/java/com/threerings/whirled/spot/server/SpotSceneManager.java
+++ b/src/java/com/threerings/whirled/spot/server/SpotSceneManager.java
@@ -123,9 +123,9 @@ public class SpotSceneManager extends SceneManager
}
@Override
- protected void gotSceneData ()
+ protected void gotSceneData (Object extras)
{
- super.gotSceneData();
+ super.gotSceneData(extras);
// keep a casted reference around to our scene
_sscene = (SpotScene)_scene;