org.elkoserver.server.workshop
Class Workshop

java.lang.Object
  extended by org.elkoserver.foundation.actor.RefTable
      extended by org.elkoserver.server.workshop.Workshop
All Implemented Interfaces:
Iterable<DispatchTarget>

public class Workshop
extends RefTable

Main state data structure in a Workshop Server.


Method Summary
 Trace appTrace()
          Obtain the application trace object for the workshop.
 void getObject(String ref, ArgRunnable handler)
          Fetch an object from the repository.
 void getObject(String ref, String collection, ArgRunnable handler)
          Fetch an object from a particular collection in the repository.
 void putObject(String ref, Encodable object)
          Store an object into the repository.
 void putObject(String ref, Encodable object, ArgRunnable resultHandler)
          Store an object into the repository with results notification.
 void putObject(String ref, Encodable object, String collection, ArgRunnable resultHandler)
          Store an object into a particular collection in the repository with results notification.
 void queryObjects(JSONObject query, int maxResults, ArgRunnable handler)
          Query the repository.
 void queryObjects(JSONObject query, String collection, int maxResults, ArgRunnable handler)
          Query a particular collection in the repository.
 void removeObject(String ref)
          Delete an object from the repository.
 void updateObject(String ref, int version, Encodable object, ArgRunnable resultHandler)
          Update the state of an object in the repository.
 void updateObject(String ref, int version, Encodable object, String collection, ArgRunnable resultHandler)
          Update the state of an object in some collection in the repository.
 
Methods inherited from class org.elkoserver.foundation.actor.RefTable
addClass, addRef, addRef, clones, dispatchMessage, dispatchMessage, get, iterator, remove, remove, rootRef
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

appTrace

public Trace appTrace()
Obtain the application trace object for the workshop.

Returns:
the workshop's trace object.

getObject

public void getObject(String ref,
                      ArgRunnable handler)
Fetch an object from the repository.

Parameters:
ref - The ref of the object desired.
handler - Callback that will be invoked with the object in question, or null if the object was not available.

getObject

public void getObject(String ref,
                      String collection,
                      ArgRunnable handler)
Fetch an object from a particular collection in the repository.

Parameters:
ref - The ref of the object desired.
collection - The name of the collection to use.
handler - Callback that will be invoked with the object in question, or null if the object was not available.

queryObjects

public void queryObjects(JSONObject query,
                         int maxResults,
                         ArgRunnable handler)
Query the repository.

Parameters:
query - JSON object containing a MongoDB query structure.
maxResults - Maximum number of result objects acceptable; a value of 0 means no limit.
handler - Callback that will be invoked with a results array, or null if the query failed.

queryObjects

public void queryObjects(JSONObject query,
                         String collection,
                         int maxResults,
                         ArgRunnable handler)
Query a particular collection in the repository.

Parameters:
query - JSON object containing a MongoDB query structure.
collection - The collection to use.
maxResults - Maximum number of result objects acceptable; a value of 0 means no limit.
handler - Callback that will be invoked with a results array, or null if the query failed.

putObject

public void putObject(String ref,
                      Encodable object)
Store an object into the repository.

Parameters:
ref - Ref of the object to write.
object - The object itself.

putObject

public void putObject(String ref,
                      Encodable object,
                      ArgRunnable resultHandler)
Store an object into the repository with results notification.

Parameters:
ref - Ref of the object to write.
object - The object itself.
resultHandler - Handler that wil be invoked with the result of the operation; the result will be null if the operation suceeded, or an error string if the operation failed.

putObject

public void putObject(String ref,
                      Encodable object,
                      String collection,
                      ArgRunnable resultHandler)
Store an object into a particular collection in the repository with results notification.

Parameters:
ref - Ref of the object to write.
object - The object itself.
collection - The name of the collection to use.
resultHandler - Handler that wil be invoked with the result of the operation; the result will be null if the operation suceeded, or an error string if the operation failed.

updateObject

public void updateObject(String ref,
                         int version,
                         Encodable object,
                         ArgRunnable resultHandler)
Update the state of an object in the repository.

Parameters:
ref - Ref of the object to write.
version - Version number of the instance being replaced
object - The object itself.
resultHandler - Handler that wil be invoked with the result of the operation; the result will be null if the operation suceeded, or an error string if the operation failed.

updateObject

public void updateObject(String ref,
                         int version,
                         Encodable object,
                         String collection,
                         ArgRunnable resultHandler)
Update the state of an object in some collection in the repository.

Parameters:
ref - Ref of the object to write.
version - Version number of the instance being replaced
object - The object itself.
collection - The collection to use.
resultHandler - Handler that wil be invoked with the result of the operation; the result will be null if the operation suceeded, or an error string if the operation failed.

removeObject

public void removeObject(String ref)
Delete an object from the repository.

Parameters:
ref - The ref of the object to be deleted.