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 String[] |
allClusterTypes
Deprecated.
|
static String |
COLLECTION
Deprecated.
|
static String |
HISTORY
Deprecated.
|
static String |
JOB
Deprecated.
|
static String |
LIFECYCLE
Deprecated.
|
static short |
NONE
Constant to return from
queryClusterSupport(String) for Cluster
types this storage does not support. |
static String |
OUTCOME
Deprecated.
|
static String |
PATH
Deprecated.
|
static String |
PROPERTY
Deprecated.
|
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 String |
ROOT
Deprecated.
|
static String |
VIEWPOINT
Deprecated.
|
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 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 |
delete(ItemPath itemPath,
String path)
Remove a CRISTAL local object from storage.
|
abstract String |
executeQuery(Query query)
Executes an SQL/OQL/XQuery/XPath/etc query in the target database.
|
abstract C2KLocalObject |
get(ItemPath itemPath,
String path)
Fetches a CRISTAL local object from storage by path
|
String[] |
getClusterContents(ItemPath itemPath,
ClusterType type)
Queries the local path below the given type and returns the possible next elements.
|
abstract String[] |
getClusterContents(ItemPath itemPath,
String path)
Queries the local path below of the item and returns the possible next elements.
|
ClusterType[] |
getClusters(ItemPath itemPath)
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 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 |
put(ItemPath itemPath,
C2KLocalObject obj)
Stores a CRISTAL local object.
|
short |
queryClusterSupport(ClusterType clusterType)
Declares whether or not this ClusterStorage can read or write a
particular CRISTAL local object type.
|
abstract short |
queryClusterSupport(String clusterType)
Deprecated.
|
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.@Deprecated public static final String ROOT
@Deprecated public static final String PATH
@Deprecated public static final String PROPERTY
@Deprecated public static final String COLLECTION
@Deprecated public static final String LIFECYCLE
Workflow@Deprecated public static final String OUTCOME
@Deprecated public static final String HISTORY
@Deprecated public static final String VIEWPOINT
@Deprecated public static final String JOB
@Deprecated public static final String[] allClusterTypes
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 short queryClusterSupport(ClusterType clusterType)
clusterType - The Cluster type requested@Deprecated public abstract short queryClusterSupport(String clusterType)
clusterType - The Cluster type requested. Must be one of the Cluster type
constants from this class.public 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) throws PersistencyException
query - the query to be executedPersistencyExceptionpublic abstract C2KLocalObject get(ItemPath itemPath, String path) throws PersistencyException
itemPath - The ItemPath of the containing Itempath - The path of the local objectPersistencyException - when retrieval failedpublic abstract void put(ItemPath itemPath, C2KLocalObject obj) throws PersistencyException
itemPath - The Item that the object will be stored underobj - The C2KLocalObject to storePersistencyException - When storage failspublic abstract void delete(ItemPath itemPath, String path) throws PersistencyException
itemPath - The containing Itempath - The path of the object to be removedPersistencyException - When deletion fails or is not allowedpublic abstract String[] getClusterContents(ItemPath itemPath, String path) throws PersistencyException
itemPath - The Item to querypath - The path within that Item to query. May be ClusterStorage.ROOT
(empty String)PersistencyException - When an error occurred during the querypublic String[] getClusterContents(ItemPath itemPath, ClusterType type) throws PersistencyException
itemPath - type - PersistencyExceptionpublic ClusterType[] getClusters(ItemPath itemPath) throws PersistencyException
itemPath - the Item to queryPersistencyException - When an error occurred during the queryCopyright © 1997–2019 CRISTAL-iSE. All rights reserved.