org.jdesktop.wonderland.server.cell
Class CellManagerMO

java.lang.Object
  extended by org.jdesktop.wonderland.server.cell.CellManagerMO
All Implemented Interfaces:
com.sun.sgs.app.ManagedObject, java.io.Serializable

public class CellManagerMO
extends java.lang.Object
implements com.sun.sgs.app.ManagedObject, java.io.Serializable

Author:
paulby
See Also:
Serialized Form

Nested Class Summary
static interface CellManagerMO.EnvironmentCellCreator
          Interface for the environment cell creator.
 
Method Summary
protected  EnvironmentCellMO createEnvironmentCell()
          Create an environment cell using the default creator.
static CellMO getCell(CellID cellID)
          Return the cell with the given ID, or null if the id is invalid
static CellManagerMO getCellManager()
          Return singleton master cell cache
static EnvironmentCellMO getEnvironmentCell()
          Get the singleton environment cell
 java.util.Set<CellID> getRootCells()
          Get the list of all root cells in the world, creating it if it doesn't exist
protected  java.util.Set<CellID> getRootCellsForUpdate()
          Convenience method to mark the root cells for update
static void initialize()
          Initialize the master cell cache.
 void insertCellInWorld(CellMO cell)
          Insert the cell into the world.
 void loadWorld()
          Load the initial world.
 void registerAvatarCellComponent(java.lang.Class<? extends CellComponentMO> componentClass)
          Register a component that will be added to avatar cells
 void registerCellComponent(java.lang.Class<? extends CellMO> cellClass, java.lang.Class<? extends CellComponentMO> componentClass)
          Register a component that will be automatically added to every cell at creation time.
 void registerEnvironmentCellCreator(CellManagerMO.EnvironmentCellCreator creator)
          Register to create the environment cell.
 void removeCellFromWorld(CellMO cell)
          Remove a cell from the world
 void saveWorld()
           
 void unregisterCellComponent(java.lang.Class<? extends CellMO> cellClass, java.lang.Class<? extends CellComponentMO> componentClass)
          Unregister a component type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initialize

public static void initialize()
Initialize the master cell cache. This is an implementation detail and should not be called by users of this class.


getCellManager

public static CellManagerMO getCellManager()
Return singleton master cell cache

Returns:
the master cell cache

getCell

public static CellMO getCell(CellID cellID)
Return the cell with the given ID, or null if the id is invalid

Parameters:
cellID - the cell ID to getTranslation
Returns:
the cell with the given ID

getEnvironmentCell

public static EnvironmentCellMO getEnvironmentCell()
Get the singleton environment cell

Returns:
the environment cell

registerEnvironmentCellCreator

public void registerEnvironmentCellCreator(CellManagerMO.EnvironmentCellCreator creator)
Register to create the environment cell. This object will be called if a WFS is loaded that does not define an environment cell.

Parameters:
creator - the creator to register

createEnvironmentCell

protected EnvironmentCellMO createEnvironmentCell()
Create an environment cell using the default creator.

Parameters:
creator - the cell creator

insertCellInWorld

public void insertCellInWorld(CellMO cell)
                       throws MultipleParentException
Insert the cell into the world.

Throws:
MultipleParentException

removeCellFromWorld

public void removeCellFromWorld(CellMO cell)
Remove a cell from the world

Parameters:
cell - the cell to remove

getRootCells

public java.util.Set<CellID> getRootCells()
Get the list of all root cells in the world, creating it if it doesn't exist

Returns:
a set of root cells

getRootCellsForUpdate

protected java.util.Set<CellID> getRootCellsForUpdate()
Convenience method to mark the root cells for update

Returns:
the root cells, marked for update

loadWorld

public void loadWorld()
Load the initial world. This will typically load the cells from WFS


saveWorld

public void saveWorld()

registerAvatarCellComponent

public void registerAvatarCellComponent(java.lang.Class<? extends CellComponentMO> componentClass)
Register a component that will be added to avatar cells

Parameters:
component -

registerCellComponent

public void registerCellComponent(java.lang.Class<? extends CellMO> cellClass,
                                  java.lang.Class<? extends CellComponentMO> componentClass)
Register a component that will be automatically added to every cell at creation time. Registrations will apply to subclasses as well, so if you register a component to be added to CellMO.class, an instance will be added to every cell at creation time.

Parameters:
cellClass - the class of cell to register on
componentClass - the class to instantiate

unregisterCellComponent

public void unregisterCellComponent(java.lang.Class<? extends CellMO> cellClass,
                                    java.lang.Class<? extends CellComponentMO> componentClass)
Unregister a component type.

Parameters:
cellClass - the class of cell to register on
componentClass - the class to instantiate


Open Wonderland - http://openwonderland.org