org.jdesktop.wonderland.server.cell
Class ViewCellCacheMO

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

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

Container for the cell cache for a viewcell. This is a nieve implementation that does not contain View Frustum culling, culling is performed only on relationship to viewcell's position.

Author:
paulby
See Also:
Serialized Form

Constructor Summary
ViewCellCacheMO(ViewCellMO view)
          Creates a new instance of ViewCellCacheMO associated with the given view.
 
Method Summary
 void generateLoadMessagesService(java.util.Collection<CellDescription> cells)
          Called by the UniverseService to request this cache generate load messages for the given cells.
 void generateUnloadMessagesService(java.util.Collection<CellDescription> cells)
          Called by the UniverseService to request this cache generate unload messages for the given cells.
protected  java.util.Set<CellID> getLoadedCells()
          Get the set of loaded cells
 ViewCellMO getViewCell()
          Gets the ViewCellMO associated with this ViewCellCacheMO.
protected  boolean isLoaded(CellID cellID)
          Return true if this cache has loaded the given cell, or false if not.
 void revalidateCellsService(java.util.Collection<CellDescription> cells)
          Update our cache because the given cells may have changed.
protected abstract  void sendLoadMessages(java.util.Collection<CellDescription> cells)
          Method to actually send the cell load messages to the associated client.
protected abstract  void sendUnloadMessages(java.util.Collection<CellDescription> unload)
          Method to actually send the cell unload messages to the associated client.
protected  boolean setLoaded(CellID cellID)
          Mark the given cell as loaded
protected  boolean setUnloaded(CellID cellID)
          Mark the given cell as unloaded
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewCellCacheMO

public ViewCellCacheMO(ViewCellMO view)
Creates a new instance of ViewCellCacheMO associated with the given view.

Parameters:
view - the view associated with this cache
Method Detail

getViewCell

public ViewCellMO getViewCell()
Gets the ViewCellMO associated with this ViewCellCacheMO.


generateLoadMessagesService

public void generateLoadMessagesService(java.util.Collection<CellDescription> cells)
Called by the UniverseService to request this cache generate load messages for the given cells. Note that this list contains all the possible cells to load, regardless of any security on those cells. It is up to the cache to enforce security on this list, and only send updates to clients that this cell is allowed to see.

Parameters:
cells - the set of cells to load

revalidateCellsService

public void revalidateCellsService(java.util.Collection<CellDescription> cells)
Update our cache because the given cells may have changed. Just like generateLoadMessagesService(), this method is responsible for enforcing security on the list of cells.

Parameters:
cells - the cells to revalidate

generateUnloadMessagesService

public void generateUnloadMessagesService(java.util.Collection<CellDescription> cells)
Called by the UniverseService to request this cache generate unload messages for the given cells. No security is required for unload messages.

Parameters:
cells - the set of cells to unload

sendLoadMessages

protected abstract void sendLoadMessages(java.util.Collection<CellDescription> cells)
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.

Parameters:
cells - the cells to generate load messages for.

sendUnloadMessages

protected abstract void sendUnloadMessages(java.util.Collection<CellDescription> unload)
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.

Parameters:
cells - the cells to generate unload messages for.

isLoaded

protected boolean isLoaded(CellID cellID)
Return true if this cache has loaded the given cell, or false if not.

Parameters:
cellID - the cell to check
Returns:
true of the given cell is loaded, or false if not

setLoaded

protected boolean setLoaded(CellID cellID)
Mark the given cell as loaded

Parameters:
cellID - the id of the loaded cell
Returns:
true if the cell id was added, or false if it was already in the set

setUnloaded

protected boolean setUnloaded(CellID cellID)
Mark the given cell as unloaded

Parameters:
cellID - the id of the unloaded cell
Returns:
true if the cell id was removed, or false if it wasn't in the set

getLoadedCells

protected java.util.Set<CellID> getLoadedCells()
Get the set of loaded cells

Returns:
a set of loaded cells


Open Wonderland - http://openwonderland.org