Package org.cristalise.storage
Class MemoryOnlyClusterStorage
java.lang.Object
org.cristalise.kernel.persistency.ClusterStorage
org.cristalise.storage.MemoryOnlyClusterStorage
-
Field Summary
Fields inherited from class org.cristalise.kernel.persistency.ClusterStorage
NONE, READ, READWRITE, WRITE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabort(TransactionKey transactionKey) voidbegin(TransactionKey transactionKey) booleancheckQuerySupport(String language) Checks whether the storage support the given type of query or notvoidclear()voidclose()Shuts down the storage.voidcommit(TransactionKey transactionKey) voiddelete(ItemPath thisItem, String path, TransactionKey transactionKey) Remove a CRISTAL local object from storage.voiddelete(ItemPath thisItem, ClusterType cluster, TransactionKey transactionKey) Remove all CRISTAL local object of the given ClusterType from storage.voiddelete(ItemPath itemPath, TransactionKey transactionKey) Removes all data of an Item.voiddumpContents(ItemPath thisItem) executeQuery(Query query, TransactionKey transactionKey) Executes an SQL/OQL/XQuery/XPath/etc query in the target database.get(ItemPath thisItem, String path, TransactionKey transactionKey) Fetches a CRISTAL local object from storage by pathString[]getClusterContents(ItemPath thisItem, String path, TransactionKey transactionKey) Queries the local path below of the item and returns the possible next elements.String[]getClusterContents(ItemPath itemPath, ClusterType type, TransactionKey transactionKey) Queries the local path below the given type and returns the possible next elements.getId()intgetLastIntegerId(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 storedgetName()voidopen()Connects to the storage.voidInforms the ClusterSorage that the Boostrap process has finished.voidInforms the ClusterSorage that connect was done.voidInforms the ClusterSorage that the start server process has finished.voidput(ItemPath thisItem, C2KLocalObject obj, TransactionKey transactionKey) Stores a CRISTAL local object.shortqueryClusterSupport(ClusterType clusterType) Declares whether or not this ClusterStorage can read or write a particular CRISTAL local object type.Methods inherited from class org.cristalise.kernel.persistency.ClusterStorage
getClusters, getClusterType, getPath, toString
-
Constructor Details
-
MemoryOnlyClusterStorage
public MemoryOnlyClusterStorage()
-
-
Method Details
-
clear
public void clear() -
open
Description copied from class:ClusterStorageConnects to the storage. It must be possible to retrieve CRISTAL local objects after this method returns.- Specified by:
openin classClusterStorage- Throws:
PersistencyException- If storage initialization failed
-
close
Description copied from class:ClusterStorageShuts down the storage. Data must be completely written to disk before this method returns, so the process can exit. No further gets or puts should follow.- Specified by:
closein classClusterStorage- Throws:
PersistencyException- If closing failed
-
checkQuerySupport
Description copied from class:ClusterStorageChecks whether the storage support the given type of query or not- Specified by:
checkQuerySupportin classClusterStorage- Parameters:
language- type of the query (e.g. SQL/XQuery/XPath/....)- Returns:
- whether the Storage supports the type of the query or not
-
queryClusterSupport
Description copied from class:ClusterStorageDeclares whether or not this ClusterStorage can read or write a particular CRISTAL local object type.- Specified by:
queryClusterSupportin classClusterStorage- Parameters:
clusterType- The Cluster type requested- Returns:
- A ClusterStorage constant: NONE, READ, WRITE, or READWRITE
-
getName
- Specified by:
getNamein classClusterStorage- Returns:
- A full name of this storage for logging
-
getId
- Specified by:
getIdin classClusterStorage- Returns:
- A short code for this storage for reference
-
executeQuery
Description copied from class:ClusterStorageExecutes an SQL/OQL/XQuery/XPath/etc query in the target database.- Specified by:
executeQueryin classClusterStorage- Parameters:
query- the query to be executedtransactionKey- the key of the transaction, can be null- Returns:
- the xml result of the query
- Throws:
PersistencyException
-
get
public C2KLocalObject get(ItemPath thisItem, String path, TransactionKey transactionKey) throws PersistencyException Description copied from class:ClusterStorageFetches a CRISTAL local object from storage by path- Specified by:
getin classClusterStorage- Parameters:
thisItem- The ItemPath of the containing Itempath- The path of the local objecttransactionKey- the key of the transaction, can be null- Returns:
- The C2KLocalObject, or null if the object was not found
- Throws:
PersistencyException- when retrieval failed
-
put
public void put(ItemPath thisItem, C2KLocalObject obj, TransactionKey transactionKey) throws PersistencyException Description copied from class:ClusterStorageStores a CRISTAL local object. The path is automatically generated.- Specified by:
putin classClusterStorage- Parameters:
thisItem- The Item that the object will be stored underobj- The C2KLocalObject to storetransactionKey- the key of the transaction, cannot be null- Throws:
PersistencyException- When storage fails
-
delete
Description copied from class:ClusterStorageRemoves all data of an Item. This should be used sparingly and responsibly, as it violated traceability. Objects removed in this way are not expected to be recoverable.- Specified by:
deletein classClusterStorage- Parameters:
itemPath- The containing ItemtransactionKey- the key of the transaction, cannot be null- Throws:
PersistencyException- When deletion fails or is not allowed
-
delete
public void delete(ItemPath thisItem, ClusterType cluster, TransactionKey transactionKey) throws PersistencyException Description copied from class:ClusterStorageRemove all CRISTAL local object of the given ClusterType from storage. This should be used sparingly and responsibly, as it violated traceability. Objects removed in this way cannot be recovered.- Specified by:
deletein classClusterStorage- Parameters:
thisItem- The containing Itemcluster- The type of the object to be removedtransactionKey- the key of the transaction, cannot be null- Throws:
PersistencyException- When deletion fails or is not allowed
-
delete
public void delete(ItemPath thisItem, String path, TransactionKey transactionKey) throws PersistencyException Description copied from class:ClusterStorageRemove a CRISTAL local object from storage. This should be used sparingly and responsibly, as it violated traceability. Objects removed in this way cannot be recovered.- Specified by:
deletein classClusterStorage- Parameters:
thisItem- The containing Itempath- The path of the object to be removedtransactionKey- the key of the transaction, cannot be null- Throws:
PersistencyException- When deletion fails or is not allowed
-
getClusterContents
public String[] getClusterContents(ItemPath thisItem, String path, TransactionKey transactionKey) throws PersistencyException Description copied from class:ClusterStorageQueries the local path below of the item and returns the possible next elements.- Specified by:
getClusterContentsin classClusterStorage- Parameters:
thisItem- 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 null- Returns:
- A String array of the possible next path elements
- Throws:
PersistencyException- When an error occurred during the query
-
getClusterContents
public String[] getClusterContents(ItemPath itemPath, ClusterType type, TransactionKey transactionKey) throws PersistencyException Description copied from class:ClusterStorageQueries the local path below the given type and returns the possible next elements.- Overrides:
getClusterContentsin classClusterStorage- Parameters:
itemPath-type-transactionKey- the key of the transaction, can be null- Returns:
- Throws:
PersistencyException
-
dumpContents
-
postBoostrap
public void postBoostrap()Description copied from class:ClusterStorageInforms the ClusterSorage that the Boostrap process has finished. It enables the implementation to perform domain specific tasks- Specified by:
postBoostrapin classClusterStorage
-
postStartServer
public void postStartServer()Description copied from class:ClusterStorageInforms the ClusterSorage that the start server process has finished. It enables the implementation to perform domain specific tasks- Specified by:
postStartServerin classClusterStorage
-
postConnect
public void postConnect()Description copied from class:ClusterStorageInforms the ClusterSorage that connect was done. It enables the implementation to perform domain specific tasks- Specified by:
postConnectin classClusterStorage
-
getLastIntegerId
public int getLastIntegerId(ItemPath itemPath, String path, TransactionKey transactionKey) throws PersistencyException Description copied from class:ClusterStorageHistory and JobList based on a integer id that is incremented each tome a new Event or Job is stored- Specified by:
getLastIntegerIdin classClusterStorage- Parameters:
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 null- Returns:
- returns the last found integer id (zero based), or -1 if not found
- Throws:
PersistencyException- When storage fails
-
begin
- Specified by:
beginin classClusterStorage- Throws:
PersistencyException
-
commit
- Specified by:
commitin classClusterStorage- Throws:
PersistencyException
-
abort
- Specified by:
abortin classClusterStorage- Throws:
PersistencyException
-