org.jdesktop.wonderland.server.cell
Class AvatarCellCacheMO

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

public class AvatarCellCacheMO
extends ViewCellCacheMO
implements com.sun.sgs.app.ManagedObject, java.io.Serializable

Container for the cell cache for an avatar. Calculates the set of cells that the client needs to load and sends the information to the client. This is a nieve implementation that does not contain View Frustum culling, culling is performed only on relationship to users position.

Author:
paulby, Bernard Horan
See Also:
Serialized Form

Nested Class Summary
static class AvatarCellCacheMO.CellLoadOp
          Operation to add a cell to the set of cached cells
protected static class AvatarCellCacheMO.CellOp
          Superclass of operations to modify the list of cached cells.
protected static class AvatarCellCacheMO.CellUnloadOp
          Operation to remove a cell from the list of cached cells
 class AvatarCellCacheMO.ImmediateRevalidateScheduler
          Perform all revalidate operations immediately in this task.
static interface AvatarCellCacheMO.RevalidateScheduler
          A revalidate scheduler defines how the various revalidate operations are managed.
 
Field Summary
protected  ClientCapabilities capabilities
           
protected  WonderlandClientID clientID
           
protected  WonderlandIdentity identity
           
protected  AvatarCellCacheMO.RevalidateScheduler scheduler
           
protected  WonderlandClientSender sender
           
 
Constructor Summary
AvatarCellCacheMO(AvatarCellMO view)
          Creates a new instance of AvatarCellCacheMO
 
Method Summary
 WonderlandClientID getClientID()
          Getter for the WonderlandClientID property.
 java.lang.String getConnectionProperty(java.lang.String key)
          Return the property from the connection handler for this cache.
protected  CellTransform getInitialPosition()
          Get the initial position for this view based on the connection properties
protected  com.sun.sgs.app.ClientSession getSession()
          Utility to get the session
 void login(WonderlandClientSender sender, WonderlandClientID clientID)
          Notify CellCache that user has logged in
protected  void logout(WonderlandClientID clientID)
          Notify CellCache that user has logged out
static CellHierarchyMessage newConfigureCellMessage(CellMO cellMO, ClientCapabilities capabilities)
          Return a new cell update message.
static CellHierarchyMessage newCreateCellMessage(CellMO cell, CellSessionProperties properties)
          Return a new Create cell message
static CellHierarchyMessage newDeleteCellMessage(CellID cellID)
          Return a new Delete cell message
static CellHierarchyMessage newLoadLocalAvatarMessage(CellMO cell, CellSessionProperties properties)
          Return a new LoadLocalAvatar cell message
static CellHierarchyUnloadMessage newUnloadCellMessage(CellMO cell)
          Return a new Cell inactive message
protected  void sendLoadMessages(java.util.Collection<CellDescription> cells)
          Method to actually send the cell load messages to the associated client.
protected  void sendUnloadMessages(java.util.Collection<CellDescription> removeCells)
          Method to actually send the cell unload messages to the associated client.
 
Methods inherited from class org.jdesktop.wonderland.server.cell.ViewCellCacheMO
generateLoadMessagesService, generateUnloadMessagesService, getLoadedCells, getViewCell, isLoaded, revalidateCellsService, setLoaded, setUnloaded
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sender

protected WonderlandClientSender sender

clientID

protected WonderlandClientID clientID

identity

protected WonderlandIdentity identity

capabilities

protected ClientCapabilities capabilities

scheduler

protected AvatarCellCacheMO.RevalidateScheduler scheduler
Constructor Detail

AvatarCellCacheMO

public AvatarCellCacheMO(AvatarCellMO view)
Creates a new instance of AvatarCellCacheMO

Method Detail

login

public void login(WonderlandClientSender sender,
                  WonderlandClientID clientID)
Notify CellCache that user has logged in


logout

protected void logout(WonderlandClientID clientID)
Notify CellCache that user has logged out


getInitialPosition

protected CellTransform getInitialPosition()
Get the initial position for this view based on the connection properties

Returns:
the initial transform, or null if there is no initial transform

sendLoadMessages

protected void sendLoadMessages(java.util.Collection<CellDescription> cells)
Description copied from class: ViewCellCacheMO
Method to actually send the cell load messages to the associated client. This method is called when the view associated with this cache moves into range of the given cells.

This method is called after any security checks are performed, so the set of cells are all cells that the client has permission to access.

Subclasses can override this method to perform their own handling of messages about loading the given cells.

Specified by:
sendLoadMessages in class ViewCellCacheMO
Parameters:
cells - the cells to generate load messages for.

sendUnloadMessages

protected void sendUnloadMessages(java.util.Collection<CellDescription> removeCells)
Description copied from class: ViewCellCacheMO
Method to actually send the cell unload messages to the associated client. This method is called when the view associated with this cache moves out of range of the given cells.

This method is called after any security checks are performed, so the set of cells are all cells that the client has permission to access.

Subclasses can override this method to perform their own handling of messages about unloading the given cells.

Specified by:
sendUnloadMessages in class ViewCellCacheMO

getConnectionProperty

public java.lang.String getConnectionProperty(java.lang.String key)
Return the property from the connection handler for this cache. The properties are set when the client creates the connection

Parameters:
key -
Returns:

getSession

protected com.sun.sgs.app.ClientSession getSession()
Utility to get the session


getClientID

public WonderlandClientID getClientID()
Getter for the WonderlandClientID property. Needed this mapping in a proximity listener when all I had was the viewCellID and needed to know their ClientId.

Returns:
The WonderlandClientID associated with this ViewCell.

newCreateCellMessage

public static CellHierarchyMessage newCreateCellMessage(CellMO cell,
                                                        CellSessionProperties properties)
Return a new Create cell message


newLoadLocalAvatarMessage

public static CellHierarchyMessage newLoadLocalAvatarMessage(CellMO cell,
                                                             CellSessionProperties properties)
Return a new LoadLocalAvatar cell message


newUnloadCellMessage

public static CellHierarchyUnloadMessage newUnloadCellMessage(CellMO cell)
Return a new Cell inactive message


newDeleteCellMessage

public static CellHierarchyMessage newDeleteCellMessage(CellID cellID)
Return a new Delete cell message


newConfigureCellMessage

public static CellHierarchyMessage newConfigureCellMessage(CellMO cellMO,
                                                           ClientCapabilities capabilities)
Return a new cell update message. Indicates that the content of the cell has changed.



Open Wonderland - http://openwonderland.org