public abstract class ClusterStorage extends Object
Interface for persistency managers of entities. It allows different kernel objects to be stored in different db backend. For instance, Properties may be stored in LDAP, while Events, Outcomes and Viewpoints could be stored in a relational database. The kernel does and needs no analytical querying of the ClusterStorages, only simple gets and puts. This may be implemented on top of the storage implementation separately.
Each item is indexed by its ItemPath, which is may be constructed from its
UUID, equivalent SystemKey object, or
Each first-level path under the Item is defined as a Cluster. Different
Clusters may be stored in different places. Each ClusterStorage must support
#get(ItemPath, String) and
#getClusterContents(ItemPath, String) for clusters they return
READ and READWRITE from queryClusterSupport and
#put(ItemPath, C2KLocalObject) and #delete(ItemPath, String)
for clusters they return WRITE and READWRITE from
#getClusterContents(ItemPath, String). Operations that have not been
declared as not supported should throw a PersistencyException. If a
cluster does not exist, get should return null, and delete should return with
no action.
| Modifier and Type | Field and Description |
|---|---|
static short |
NONE
Constant to return from
#queryClusterSupport(String) for Cluster
types this storage does not support. |
static short |
READ
Constant to return from
#queryClusterSupport(String) for Cluster
types this storage can read from a database but not write. |
static short |
READWRITE
Constant to return from
#queryClusterSupport(String) for data
stores that CRISTAL may use for both reading and writing for the given
Cluster type. |
static short |
WRITE
Constant to return from
#queryClusterSupport(String) for Cluster
types this storage can write to a database but not read. |
| Constructor and Description |
|---|
ClusterStorage() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
abort(TransactionKey transactionKey) |
abstract void |
begin(TransactionKey transactionKey) |
abstract boolean |
checkQuerySupport(String language)
Checks whether the storage support the given type of query or not
|
abstract void |
close()
Shuts down the storage.
|
abstract void |
commit(TransactionKey transactionKey) |
abstract void |
delete(ItemPath itemPath,
String path,
TransactionKey transactionKey)
Remove a CRISTAL local object from storage.
|
abstract String |
executeQuery(Query query,
TransactionKey transactionKey)
Executes an SQL/OQL/XQuery/XPath/etc query in the target database.
|
abstract C2KLocalObject |
get(ItemPath itemPath,
String path,
TransactionKey transactionKey)
Fetches a CRISTAL local object from storage by path
|
String[] |
getClusterContents(ItemPath itemPath,
ClusterType type,
TransactionKey transactionKey)
Queries the local path below the given type and returns the possible next elements.
|
abstract String[] |
getClusterContents(ItemPath itemPath,
String path,
TransactionKey transactionKey)
Queries the local path below of the item and returns the possible next elements.
|
ClusterType[] |
getClusters(ItemPath itemPath,
TransactionKey transactionKey)
Queries the Item for the Clusters (root path elements) that are available.
|
protected static ClusterType |
getClusterType(String path)
Utility method to find the cluster for a particular Local Object (the first part of its path)
|
abstract String |
getId() |
abstract int |
getLastIntegerId(ItemPath itemPath,
String path,
TransactionKey transactionKey)
History and JobList based on a integer id that is incremented each tome a new Event or Job is stored
|
abstract String |
getName() |
static String |
getPath(C2KLocalObject obj)
Gives the path for a local object.
|
abstract void |
open(Authenticator auth)
Connects to the storage.
|
abstract void |
postBoostrap()
Informs the ClusterSorage that the Boostrap process has finished.
|
abstract void |
postConnect()
Informs the ClusterSorage that connect was done.
|
abstract void |
postStartServer()
Informs the ClusterSorage that the start server process has finished.
|
abstract void |
put(ItemPath itemPath,
C2KLocalObject obj,
TransactionKey transactionKey)
Stores a CRISTAL local object.
|
abstract short |
queryClusterSupport(ClusterType clusterType)
Declares whether or not this ClusterStorage can read or write a
particular CRISTAL local object type.
|
public static final short NONE
#queryClusterSupport(String) for Cluster
types this storage does not support.public static final short READ
#queryClusterSupport(String) for Cluster
types this storage can read from a database but not write. An example
would be pre-existing data in a database that is mapped to Items in some
way.public static final short WRITE
#queryClusterSupport(String) for Cluster
types this storage can write to a database but not read. An example would
be a realtime database export of data, which is transformed in an
unrecoverable way for use in other systems.public static final short READWRITE
#queryClusterSupport(String) for data
stores that CRISTAL may use for both reading and writing for the given
Cluster type.public abstract void open(Authenticator auth) throws PersistencyException
auth - The Authenticator instance that the user or server logged in
with.PersistencyException - If storage initialization failedpublic abstract void close()
throws PersistencyException
PersistencyException - If closing failedpublic abstract void postBoostrap()
throws PersistencyException
PersistencyException - Database errorpublic abstract void postStartServer()
throws PersistencyException
PersistencyException - Database errorpublic abstract void postConnect()
throws PersistencyException
PersistencyException - Database errorpublic abstract short queryClusterSupport(ClusterType clusterType)
clusterType - The Cluster type requestedpublic abstract boolean checkQuerySupport(String language)
language - type of the query (e.g. SQL/XQuery/XPath/....)public abstract String getName()
public abstract String getId()
protected static ClusterType getClusterType(String path)
path - object pathpublic static String getPath(C2KLocalObject obj)
obj - C2KLocalObjectpublic abstract String executeQuery(Query query, TransactionKey transactionKey) throws PersistencyException
query - the query to be executedtransactionKey - the key of the transaction, can be nullPersistencyExceptionpublic abstract int getLastIntegerId(ItemPath itemPath, String path, TransactionKey transactionKey) throws PersistencyException
itemPath - The ItemPath (UUID) of the containing Itempath - the cluster patch, either equals to 'AuditTrail' or 'Job'transactionKey - the key of the transaction, can be nullPersistencyException - When storage failspublic abstract C2KLocalObject get(ItemPath itemPath, String path, TransactionKey transactionKey) throws PersistencyException
itemPath - The ItemPath of the containing Itempath - The path of the local objecttransactionKey - the key of the transaction, can be nullPersistencyException - when retrieval failedpublic abstract void put(ItemPath itemPath, C2KLocalObject obj, TransactionKey transactionKey) throws PersistencyException
itemPath - The Item that the object will be stored underobj - The C2KLocalObject to storetransactionKey - the key of the transaction, cannot be nullPersistencyException - When storage failspublic abstract void delete(ItemPath itemPath, String path, TransactionKey transactionKey) throws PersistencyException
itemPath - The containing Itempath - The path of the object to be removedtransactionKey - the key of the transaction, cannot be nullPersistencyException - When deletion fails or is not allowedpublic abstract String[] getClusterContents(ItemPath itemPath, String path, TransactionKey transactionKey) throws PersistencyException
itemPath - The Item to querypath - The path within that Item to query. May be ClusterStorage.ROOT (empty String)transactionKey - the key of the transaction, can be nullPersistencyException - When an error occurred during the querypublic String[] getClusterContents(ItemPath itemPath, ClusterType type, TransactionKey transactionKey) throws PersistencyException
itemPath - type - transactionKey - the key of the transaction, can be nullPersistencyExceptionpublic ClusterType[] getClusters(ItemPath itemPath, TransactionKey transactionKey) throws PersistencyException
itemPath - the Item to querytransactionKey - the key of the transaction, can be nullPersistencyException - When an error occurred during the querypublic abstract void begin(TransactionKey transactionKey) throws PersistencyException
PersistencyExceptionpublic abstract void commit(TransactionKey transactionKey) throws PersistencyException
PersistencyExceptionpublic abstract void abort(TransactionKey transactionKey) throws PersistencyException
PersistencyExceptionCopyright © 1997–2022 CRISTAL-iSE. All rights reserved.