|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
K
- the class of keys in the datastoreT
- the class of persistent objects in the datastorepublic interface DataStore<K,T extends Persistent>
DataStore handles actual object persistence. Objects can be persisted,
fetched, queried or deleted by the DataStore methods. DataStores can be
constructed by an instance of DataStoreFactory
.
DataStores implementations should be thread safe.
Note: Results of updates (put(Object, Persistent)
,
delete(Object)
and deleteByQuery(Query)
operations) are
guaranteed to be visible to subsequent get / execute operations ONLY
after a subsequent call to flush()
. Additionally, exception
handling is largely DataStore specific and is not largely dealt
with from within this interface.
Method Summary | |
---|---|
void |
close()
Close the DataStore. |
void |
createSchema()
Creates the optional schema or table (or similar) in the datastore to hold the objects. |
boolean |
delete(K key)
Deletes the object with the given key |
long |
deleteByQuery(Query<K,T> query)
Deletes all the objects matching the query. |
void |
deleteSchema()
Deletes the underlying schema or table (or similar) in the datastore that holds the objects. |
Result<K,T> |
execute(Query<K,T> query)
Executes the given query and returns the results. |
void |
flush()
Forces the write caches to be flushed. |
T |
get(K key)
Returns the object corresponding to the given key fetching all the fields. |
T |
get(K key,
String[] fields)
Returns the object corresponding to the given key. |
BeanFactory<K,T> |
getBeanFactory()
Returns the BeanFactory used by the DataStore |
Class<K> |
getKeyClass()
Returns the class of the keys |
List<PartitionQuery<K,T>> |
getPartitions(Query<K,T> query)
Partitions the given query and returns a list of PartitionQuery s,
which will execute on local data. |
Class<T> |
getPersistentClass()
Returns the class of the persistent objects |
String |
getSchemaName()
Returns the schema name given to this DataStore |
void |
initialize(Class<K> keyClass,
Class<T> persistentClass,
Properties properties)
Initializes this DataStore. |
K |
newKey()
Returns a new instance of the key object. |
T |
newPersistent()
Returns a new instance of the managed persistent object. |
Query<K,T> |
newQuery()
Constructs and returns a new Query. |
void |
put(K key,
T obj)
Inserts the persistent object with the given key. |
boolean |
schemaExists()
Returns whether the schema that holds the data exists in the datastore. |
void |
setBeanFactory(BeanFactory<K,T> beanFactory)
Sets the BeanFactory to use by the DataStore. |
void |
setKeyClass(Class<K> keyClass)
Sets the class of the keys |
void |
setPersistentClass(Class<T> persistentClass)
Sets the class of the persistent objects |
void |
truncateSchema()
Deletes all the data associated with the schema, but keeps the schema (table or similar) intact. |
Method Detail |
---|
void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties)
keyClass
- the class of the keyspersistentClass
- the class of the persistent objectsproperties
- extra metadata
IOException
void setKeyClass(Class<K> keyClass)
keyClass
- the class of keysClass<K> getKeyClass()
void setPersistentClass(Class<T> persistentClass)
persistentClass
- class of persistent objectsClass<T> getPersistentClass()
String getSchemaName()
void createSchema()
IOException
void deleteSchema()
IOException
void truncateSchema()
IOException
boolean schemaExists()
IOException
K newKey()
IOException
T newPersistent()
IOException
T get(K key)
key
- the key of the object
IOException
T get(K key, String[] fields)
key
- the key of the objectfields
- the fields required in the object. Pass null, to retrieve all fields
IOException
void put(K key, T obj)
IOException
boolean delete(K key)
key
- the key of the object
IOException
long deleteByQuery(Query<K,T> query)
query
- matching records to this query will be deleted
IOException
Result<K,T> execute(Query<K,T> query)
query
- the query to execute.
Result
object.
IOException
Query<K,T> newQuery()
List<PartitionQuery<K,T>> getPartitions(Query<K,T> query) throws IOException
PartitionQuery
s,
which will execute on local data.
query
- the base query to create the partitions for. If the query
is null, then the data store returns the partitions for the default query
(returning every object)
IOException
void flush()
IOException
void setBeanFactory(BeanFactory<K,T> beanFactory)
BeanFactory
to use by the DataStore.
beanFactory
- the BeanFactory to useBeanFactory<K,T> getBeanFactory()
void close()
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |