org.elkoserver.objdb.store.filestore
Class FileObjectStore

java.lang.Object
  extended by org.elkoserver.objdb.store.filestore.FileObjectStore
All Implemented Interfaces:
ObjectStore

public class FileObjectStore
extends Object
implements ObjectStore

A simple ObjectStore implementation that stores objects in text files, one file per object. Each file contains a JSON-encoded representation of the object it stores.


Constructor Summary
FileObjectStore()
          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

FileObjectStore

public FileObjectStore()
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" should specify the pathname of the directory in which the object description files are stored.

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.

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

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.