org.jdesktop.wonderland.server.wfs.exporter
Class CellExportService

java.lang.Object
  extended by com.sun.sgs.impl.util.AbstractService
      extended by org.jdesktop.wonderland.server.wfs.exporter.CellExportService
All Implemented Interfaces:
com.sun.sgs.service.Service, CellExportManager

public class CellExportService
extends com.sun.sgs.impl.util.AbstractService
implements CellExportManager

Author:
kaplanj, Bernard Horan

Nested Class Summary
 
Nested classes/interfaces inherited from class com.sun.sgs.impl.util.AbstractService
com.sun.sgs.impl.util.AbstractService.State, com.sun.sgs.impl.util.AbstractService.Version
 
Nested classes/interfaces inherited from interface org.jdesktop.wonderland.server.wfs.exporter.CellExportManager
CellExportManager.CellExportListener, CellExportManager.CellExportResult, CellExportManager.ListRecordingsListener, CellExportManager.RecordingCreationListener, CellExportManager.SnapshotCreationListener
 
Field Summary
 
Fields inherited from class com.sun.sgs.impl.util.AbstractService
appName, dataService, IO_TASK_PROPERTY_PREFIX, IO_TASK_RETRIES_PROPERTY, IO_TASK_WAIT_TIME_PROPERTY, maxIoAttempts, retryWaitTime, taskOwner, taskScheduler, transactionScheduler, txnProxy
 
Constructor Summary
CellExportService(java.util.Properties props, com.sun.sgs.kernel.ComponentRegistry registry, com.sun.sgs.service.TransactionProxy proxy)
           
 
Method Summary
 void createRecording(java.lang.String name, java.util.Set<CellID> cells, CellExportManager.RecordingCreationListener listener)
          Create a new recording for writing cells to.
 void createSnapshot(java.lang.String name, CellExportManager.SnapshotCreationListener listener)
          Create a new snapshot for writing cells to.
protected  void doReady()
           
protected  void doShutdown()
           
 void exportCells(WorldRoot worldRoot, java.util.Set<CellID> cellIDs, CellExportManager.CellExportListener listener, boolean recordCellIDs)
          Write a set of cells to the given snapshot/recording.
 java.lang.String getName()
           
protected  void handleServiceVersionMismatch(com.sun.sgs.impl.util.AbstractService.Version oldVersion, com.sun.sgs.impl.util.AbstractService.Version currentVersion)
           
 void listRecordings(MessageID messageID, WonderlandClientSender sender, WonderlandClientID clientID, CellExportManager.ListRecordingsListener listener)
          List the recordings that are currently accessible via the web service.
 
Methods inherited from class com.sun.sgs.impl.util.AbstractService
callFinished, callStarted, checkNonTransactionalContext, checkServiceVersion, createTaskQueue, getDataService, getState, isAlive, isInInitializedState, isRetryableException, ready, runIoTask, shutdown, shuttingDown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CellExportService

public CellExportService(java.util.Properties props,
                         com.sun.sgs.kernel.ComponentRegistry registry,
                         com.sun.sgs.service.TransactionProxy proxy)
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface com.sun.sgs.service.Service
Overrides:
getName in class com.sun.sgs.impl.util.AbstractService

doReady

protected void doReady()
Specified by:
doReady in class com.sun.sgs.impl.util.AbstractService

doShutdown

protected void doShutdown()
Specified by:
doShutdown in class com.sun.sgs.impl.util.AbstractService

handleServiceVersionMismatch

protected void handleServiceVersionMismatch(com.sun.sgs.impl.util.AbstractService.Version oldVersion,
                                            com.sun.sgs.impl.util.AbstractService.Version currentVersion)
Specified by:
handleServiceVersionMismatch in class com.sun.sgs.impl.util.AbstractService

createSnapshot

public void createSnapshot(java.lang.String name,
                           CellExportManager.SnapshotCreationListener listener)
Description copied from interface: CellExportManager
Create a new snapshot for writing cells to. This method will contact the remote web service to create a new snapshot, and then call the given listener with the result of that call.

Specified by:
createSnapshot in interface CellExportManager
Parameters:
name - the name of the snapshot to create, or null to use the default name
listener - a snapshot creation listener that will be notified of the result of this call

createRecording

public void createRecording(java.lang.String name,
                            java.util.Set<CellID> cells,
                            CellExportManager.RecordingCreationListener listener)
Description copied from interface: CellExportManager
Create a new recording for writing cells to. This method will contact the remote web service to create a new recording, and then call the given listener with the result of that call.

Specified by:
createRecording in interface CellExportManager
Parameters:
name - the name of the recording to create
cells - the set of cells to record
listener - a recording creation listener that will be notified of the result of this call

exportCells

public void exportCells(WorldRoot worldRoot,
                        java.util.Set<CellID> cellIDs,
                        CellExportManager.CellExportListener listener,
                        boolean recordCellIDs)
Description copied from interface: CellExportManager
Write a set of cells to the given snapshot/recording. This method will fetch the given set of cells, and write the contents of the cells and all their children to the remote web service. Finally, the listener will be notified with the results of the call.

Specified by:
exportCells in interface CellExportManager
Parameters:
worldRoot - the snapshot/recording to write to
cellIDs - a set of cell IDs to write. Each cellID will be used as a root for writing, so the entire graph under the given set of cell IDs will be written. The cellIDs set will be accessed across multiple Darkstar transactions, so it is essential that the iterator for the set be serializable and work correctly in the face of concurrent access. Typically, a ScalableHashSet is the best choice for the set.
listener - a listener that will be notified of the results
recordCellIDs - if true, record the cellID of each cell

listRecordings

public void listRecordings(MessageID messageID,
                           WonderlandClientSender sender,
                           WonderlandClientID clientID,
                           CellExportManager.ListRecordingsListener listener)
Description copied from interface: CellExportManager
List the recordings that are currently accessible via the web service. This is used to respond to a client's request to open a form for a user to select a "tape".

The listener will be notifed with the results of the call. The inclusion of these parameters is because the originating message requires a ResponseMessage return, which in turn requires these parameters.

Specified by:
listRecordings in interface CellExportManager
Parameters:
messageID - the id of the message that originated the request
sender - the sender of the message request
clientID - the wonderlandClientID of the request
listener - a list recordings listener whose method listRecordingsResult is called on success, or listRecordingsFailed on failure.


Open Wonderland - http://openwonderland.org