org.elkoserver.objdb.store.mongostore
Class MongoObjectStore

java.lang.Object
  extended by org.elkoserver.objdb.store.mongostore.MongoObjectStore
All Implemented Interfaces:
ObjectStore

public class MongoObjectStore
extends Object
implements ObjectStore

An ObjectStore implementation that stores objects in a MongoDB NoSQL object database.


Constructor Summary
MongoObjectStore()
          Constructor.
 
Method Summary
 void getObjects(RequestDesc[] what, GetResultHandler handler)
          Service a 'get' request.
 void initialize(BootProperties props, String propRoot, Trace appTrace)
          Do the initialization required to begin providing object store services.
 void putObjects(PutDesc[] what, RequestResultHandler handler)
          Service a 'put' request.
 void queryObjects(QueryDesc[] what, GetResultHandler handler)
          Service a 'query' request.
 void removeObjects(RequestDesc[] what, RequestResultHandler handler)
          Service a 'remove' request.
 void shutdown()
          Do any work required immediately prior to shutting down the server.
 void updateObjects(UpdateDesc[] what, RequestResultHandler handler)
          Service an 'update' request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MongoObjectStore

public MongoObjectStore()
Constructor. Currently there is nothing to do, since all the real initialization work happens in initialize().

Method Detail

initialize

public void initialize(BootProperties props,
                       String propRoot,
                       Trace appTrace)
Do the initialization required to begin providing object store services.

The property "propRoot.odb.mongo.hostport" should specify the address of the MongoDB server holding the objects.

The optional property "propRoot.odb.mongo.dbname" allows the Mongo database name to be specified. If omitted, this defaults to "elko".

The optional property "propRoot.odb.mongo.collname" allows the collection containing the object repository to be specified. If omitted, this defaults to "odb".

Specified by:
initialize in interface ObjectStore
Parameters:
props - Properties describing configuration information.
propRoot - Prefix string for selecting relevant properties.
appTrace - Trace object for use in logging.

getObjects

public void getObjects(RequestDesc[] what,
                       GetResultHandler handler)
Service a 'get' request. This is a request to retrieve one or more objects from the object store.

Specified by:
getObjects in interface ObjectStore
Parameters:
what - The objects sought.
handler - Object to receive results (i.e., the objects retrieved or failure indicators), when available.

putObjects

public void putObjects(PutDesc[] what,
                       RequestResultHandler handler)
Service a 'put' request. This is a request to write one or more objects to the object store.

Specified by:
putObjects in interface ObjectStore
Parameters:
what - The objects to be written.
handler - Object to receive results (i.e., operation success or failure indicators), when available.

updateObjects

public void updateObjects(UpdateDesc[] what,
                          RequestResultHandler handler)
Service an 'update' request. This is a request to write one or more objects to the store, subject to a version number check to assure atomicity.

Specified by:
updateObjects in interface ObjectStore
Parameters:
what - The objects to be written.
handler - Object to receive results (i.e., operation success or failure indicators), when available.

queryObjects

public void queryObjects(QueryDesc[] what,
                         GetResultHandler handler)
Service a 'query' request. This is a request to query one or more objects from the store.

Specified by:
queryObjects in interface ObjectStore
Parameters:
what - Query templates for the objects sought.
handler - Object to receive results (i.e., the objects retrieved or failure indicators), when available.

removeObjects

public void removeObjects(RequestDesc[] what,
                          RequestResultHandler handler)
Service a 'remove' request. This is a request to delete one or more objects from the object store.

Specified by:
removeObjects in interface ObjectStore
Parameters:
what - The objects to be removed.
handler - Object to receive results (i.e., operation success or failure indicators), when available.

shutdown

public void shutdown()
Do any work required immediately prior to shutting down the server. This method gets invoked at most once, at server shutdown time.

Specified by:
shutdown in interface ObjectStore