com.monad.homerun.store
Interface ObjectStore


public interface ObjectStore

ObjectStore interface describes methods for managing a data object store, including a primitive indexing facility


Method Summary
 boolean addObject(java.lang.String key, java.lang.String group, java.lang.Object object)
          Adds an object to the store
 boolean containsObject(java.lang.String key, java.lang.String group)
          Does the object exist in the group of this store ?
 void deIndex(java.lang.String group, java.lang.String indexName, java.lang.String indexKey, java.lang.String objectKey)
          Removes an index entry
 java.lang.String[] getIndexKeys(java.lang.String group, java.lang.String indexName)
          Obtains a list of keys in an index
 java.lang.String[] getKeys(java.lang.String keyFilter, java.lang.String group)
          Returns a list of keys of objects currently in the group of the store, filtered by keyFilter if non-null
 java.lang.Object getObject(java.lang.String key, java.lang.String group)
          Retrieves an object from the store from given group
 java.lang.String[] getObjectKeys(java.lang.String group, java.lang.String indexName, java.lang.String indexKey)
          Obtains a list of indexed object keys
 void index(java.lang.String group, java.lang.String indexName, java.lang.String indexKey, java.lang.Object objectKey)
          Indexes an object by the passed index key
 java.lang.Object readObject(java.io.InputStream in)
          Reads an object from a specified output stream
 boolean removeObject(java.lang.String key, java.lang.String group)
          Removes an object from the store
 boolean updateObject(java.lang.String key, java.lang.String group, java.lang.Object object)
          Updates (over-writes) an object in the store
 void verifyIndex(java.lang.String group, java.lang.String indexName)
          Verifies the integrity of an index
 boolean writeObject(java.lang.String key, java.lang.String group, java.lang.Object object)
          Adds or over-writes an object in the store
 boolean writeObjects(java.util.List objects, java.io.OutputStream out)
          Writes a list of objects to a specified output stream
 

Method Detail

getKeys

java.lang.String[] getKeys(java.lang.String keyFilter,
                           java.lang.String group)
Returns a list of keys of objects currently in the group of the store, filtered by keyFilter if non-null

Parameters:
keyFilter - key substring to match, or null for all keys
group - the storage group
Returns:
keylist an array of keys

containsObject

boolean containsObject(java.lang.String key,
                       java.lang.String group)
Does the object exist in the group of this store ?

Parameters:
key - the storage key
group - the storage group
Returns:
true if store contains an object with key

getObject

java.lang.Object getObject(java.lang.String key,
                           java.lang.String group)
Retrieves an object from the store from given group

Parameters:
key - the storage key
group - the storage group
Returns:
object a new deserialized object instance

addObject

boolean addObject(java.lang.String key,
                  java.lang.String group,
                  java.lang.Object object)
Adds an object to the store

Parameters:
key - the storage key
group - the storage group
object - the object instance to store
Returns:
true if object successfully added to store, false if already there or could not store

removeObject

boolean removeObject(java.lang.String key,
                     java.lang.String group)
Removes an object from the store

Parameters:
key - the storage key
group - the storage group
Returns:
true if object successfully removed from store, false if object not found or could not remove

updateObject

boolean updateObject(java.lang.String key,
                     java.lang.String group,
                     java.lang.Object object)
Updates (over-writes) an object in the store

Parameters:
key - the storage key
group - the storage group
object - the object instance to update
Returns:
true if object successfully updated in store, false if object not found or could not update

writeObject

boolean writeObject(java.lang.String key,
                    java.lang.String group,
                    java.lang.Object object)
Adds or over-writes an object in the store

Parameters:
key - the storage key
group - the storage group
object - the object instance to write
Returns:
false if IO error, else true

index

void index(java.lang.String group,
           java.lang.String indexName,
           java.lang.String indexKey,
           java.lang.Object objectKey)
Indexes an object by the passed index key

Parameters:
group - the storage group
indexName - which object index to update
indexKey - the key to add to index
objectKey - the native object key

deIndex

void deIndex(java.lang.String group,
             java.lang.String indexName,
             java.lang.String indexKey,
             java.lang.String objectKey)
Removes an index entry

Parameters:
group - the storage group
indexName - which object index to update
indexKey - the key to remove from index
objectKey - the native object key

getIndexKeys

java.lang.String[] getIndexKeys(java.lang.String group,
                                java.lang.String indexName)
Obtains a list of keys in an index

Parameters:
group - the storage group
indexName - which object index to query
Returns:
list of index key entries

getObjectKeys

java.lang.String[] getObjectKeys(java.lang.String group,
                                 java.lang.String indexName,
                                 java.lang.String indexKey)
Obtains a list of indexed object keys

Parameters:
group - the storage group
indexName - which object index to query
indexKey - key to query for objects
Returns:
list of object keys

verifyIndex

void verifyIndex(java.lang.String group,
                 java.lang.String indexName)
Verifies the integrity of an index

Parameters:
group - the storage group
indexName - the object index to verify

writeObjects

boolean writeObjects(java.util.List objects,
                     java.io.OutputStream out)
Writes a list of objects to a specified output stream

Parameters:
objects - the objects to write
out - an output stream
Returns:
true if all objects written, else false

readObject

java.lang.Object readObject(java.io.InputStream in)
Reads an object from a specified output stream

Parameters:
in - an input stream
Returns:
a new deserialized object instance


Copyright © 2006-2009 Richard Rodgers. All Rights Reserved.