public abstract class ClusterStorage extends Object
Interface for persistency managers of entities. It allows different kernel objects to be stored in different 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
An array of all currently supported cluster types, for iterative
purposes.
|
static String |
COLLECTION
The root of the Collection object cluster.
|
static String |
HISTORY
This is the cluster that contains all event for this Item.
|
static String |
JOB
Agents store their persistent jobs in this cluster that have been pushed
to them by activities configured to do so.
|
static String |
LIFECYCLE
The cluster which holds the Item workflow.
|
static short |
NONE
Constant to return from
queryClusterSupport(String) for Cluster
types this storage does not support. |
static String |
OUTCOME
This cluster holds all outcomes of this Item.
|
static String |
PROPERTY
The root of the Property object cluster.
|
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
The defined path of the root of the CRISTAL Kernel object cluster tree.
|
static String |
VIEWPOINT
This cluster contains all viewpoints.
|
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 |
close()
Shuts down the storage.
|
abstract void |
delete(ItemPath itemPath,
String path)
Remove a CRISTAL local object from storage.
|
abstract C2KLocalObject |
get(ItemPath itemPath,
String path)
Fetches a CRISTAL local object from storage
|
abstract String[] |
getClusterContents(ItemPath itemPath,
String path)
Queries the local path below the given root and returns the possible next
elements.
|
protected static String |
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.
|
abstract short |
queryClusterSupport(String 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 static final String ROOT
public static final String PROPERTY
public static final String COLLECTION
public static final String LIFECYCLE
Workflow,
Constant Field Valuespublic static final String OUTCOME
public static final String HISTORY
public static final String VIEWPOINT
public static final String JOB
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 abstract short queryClusterSupport(String clusterType)
clusterType - The Cluster type requested. Must be one of the Cluster type
constants from this class.public abstract String getName()
public abstract String getId()
protected static String getClusterType(String path)
Local - object pathpublic static String getPath(C2KLocalObject obj)
C2KLocalObject - public 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 queryCopyright © 1997–2016 CRISTAL-iSE. All rights reserved.