org.jdesktop.wonderland.common.cell.state
Class CellServerState

java.lang.Object
  extended by org.jdesktop.wonderland.common.cell.state.CellServerState
All Implemented Interfaces:
java.io.Serializable, CellState
Direct Known Subclasses:
AvatarCellServerState, ModelCellServerState

public abstract class CellServerState
extends java.lang.Object
implements CellState, java.io.Serializable

The CellServerState class is the base class for all classes that represent the setup information for specific cell types. This class must be overridden by the cell-specific setup class.

In additional to the setup information defined here, the cell-specific setup class may also add additional parameters and require one or more component setup classes. It must define the getServerClassName() method to return the fully-qualified name of the server-side cell class.

The subclass of this class must be annotated with @XmlRootElement that defines the root element for all documents of that cell type. It must be unique for all cell types.

Author:
Jordan Slott
See Also:
Serialized Form

Constructor Summary
CellServerState()
          Default constructor
 
Method Summary
 void addComponentServerState(CellComponentServerState serverState)
          Adds a component server state.
static CellServerState decode(java.io.Reader r)
          Takes the input reader of the XML data and instantiates an instance of the CellServerState class
static CellServerState decode(java.io.Reader r, javax.xml.bind.Unmarshaller unmarshaller)
          Takes the input reader of the XML file and instantiates an instance of the CellServerState class.
 void encode(java.io.Writer w)
          Writes the CellServerState class to an output writer.
 void encode(java.io.Writer w, javax.xml.bind.Marshaller marshaller)
          Writes the CellServerState class to an output writer.
 BoundingVolumeHint getBoundingVolumeHint()
          Returns the bounding volume hint for intelligent initial Cell placement.
 CellComponentServerState getComponentServerState(java.lang.Class clazz)
          Returns a CellComponentServerState given its Class, or null if a server state object is not present on the cell server state class of the given Class type.
 java.util.Map<java.lang.Class,CellComponentServerState> getComponentServerStates()
          Returns a map of all of the CellComponentServerState objects.
 java.util.Map<java.lang.String,java.lang.String> getMetaData()
          Returns the cell metadata.
 java.lang.String getName()
           
abstract  java.lang.String getServerClassName()
          Returns the fully-qualified class name for the server-side cell class to instantiate.
 void removeAllComponentServerStates()
          Removes all of the CellComponentServerStates on this Cell server state.
 void removeComponentServerState(java.lang.Class clazz)
          Removes a CellComponentServerState given its Class.
 void setBoundingVolumeHint(BoundingVolumeHint boundingVolumeHint)
          Sets the bounding volume hint for intelligent initial Cell placement.
 void setMetaData(java.util.Map<java.lang.String,java.lang.String> metadata)
          Sets the cell's metadata.
 void setName(java.lang.String name)
           
 java.lang.String toString()
          Returns a string representation of this class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CellServerState

public CellServerState()
Default constructor

Method Detail

getServerClassName

public abstract java.lang.String getServerClassName()
Returns the fully-qualified class name for the server-side cell class to instantiate.

Returns:
The FQCN of the server-side cell class

addComponentServerState

public void addComponentServerState(CellComponentServerState serverState)
Adds a component server state. If a server state of the same Class has already been added, this replaces the existing server state.

Parameters:
serverState - The component server state to add

getComponentServerState

public CellComponentServerState getComponentServerState(java.lang.Class clazz)
Returns a CellComponentServerState given its Class, or null if a server state object is not present on the cell server state class of the given Class type.

Parameters:
clazz - The Class of the component server-state object
Returns:
The component server state object if it exist, null otherwise

getComponentServerStates

public java.util.Map<java.lang.Class,CellComponentServerState> getComponentServerStates()
Returns a map of all of the CellComponentServerState objects.

Returns:
A Map of Class object to their component server-state objects

removeComponentServerState

public void removeComponentServerState(java.lang.Class clazz)
Removes a CellComponentServerState given its Class. If a server state for the given Class does not exist, this method does nothing.

Parameters:
clazz - The Class of the component server-state object

removeAllComponentServerStates

public void removeAllComponentServerStates()
Removes all of the CellComponentServerStates on this Cell server state.


getMetaData

public java.util.Map<java.lang.String,java.lang.String> getMetaData()
Returns the cell metadata.

Returns:
The cell metadata

setMetaData

public void setMetaData(java.util.Map<java.lang.String,java.lang.String> metadata)
Sets the cell's metadata. If null, then this property will not be written out to the file.

Parameters:
metadata - The new cell metadata

getBoundingVolumeHint

public BoundingVolumeHint getBoundingVolumeHint()
Returns the bounding volume hint for intelligent initial Cell placement.

Returns:
The bounding volume hint information

setBoundingVolumeHint

public void setBoundingVolumeHint(BoundingVolumeHint boundingVolumeHint)
Sets the bounding volume hint for intelligent initial Cell placement.

Parameters:
boundingVolumeHint - The bounding volume hint

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

decode

public static CellServerState decode(java.io.Reader r)
                              throws javax.xml.bind.JAXBException
Takes the input reader of the XML data and instantiates an instance of the CellServerState class

Parameters:
r - The input reader of the XML data
Throws:
javax.xml.bind.JAXBException

decode

public static CellServerState decode(java.io.Reader r,
                                     javax.xml.bind.Unmarshaller unmarshaller)
                              throws javax.xml.bind.JAXBException
Takes the input reader of the XML file and instantiates an instance of the CellServerState class. Also takes the unmarshaller to use to decode the server state. Appropriate unmarshallers can be retrieved from the CellServerStateFactory.

Parameters:
r - The input data of the version XML data
unmarshaller - the unmarshaller to use while decoding. If no unmashaller is specified, the unmarshaller associated with the system classloader will be used.
Throws:
javax.xml.bind.JAXBException

encode

public void encode(java.io.Writer w)
            throws javax.xml.bind.JAXBException
Writes the CellServerState class to an output writer.

Parameters:
w - The output write to write to
Throws:
javax.xml.bind.JAXBException

encode

public void encode(java.io.Writer w,
                   javax.xml.bind.Marshaller marshaller)
            throws javax.xml.bind.JAXBException
Writes the CellServerState class to an output writer. Also takes the marshaller to use to encode the server state. Appropriate marshallers can be retrieved from the CellServerStateFactory.

Parameters:
w - The output write to write to
marshaller - the marshaller to use, or null to use the marshaller associated with the system classloader
Throws:
javax.xml.bind.JAXBException

toString

public java.lang.String toString()
Returns a string representation of this class

Overrides:
toString in class java.lang.Object
Returns:
The setup information as a string


Open Wonderland - http://openwonderland.org