Package org.cristalise.storage
Class XMLClusterStorage
java.lang.Object
org.cristalise.kernel.persistency.ClusterStorage
org.cristalise.storage.XMLClusterStorage
Implementation of ClusterStorage providing the XML file based persistence.
-
Field Summary
Fields inherited from class org.cristalise.kernel.persistency.ClusterStorage
NONE, READ, READWRITE, WRITE -
Constructor Summary
ConstructorsConstructorDescriptionXMLClusterStorage(String root) Create new XMLClusterStorage with specific setup, Used in predefined stepBulkImportXMLClusterStorage(String root, String ext, Boolean useDir) Create new XMLClusterStorage with specific setup, Used in predefined stepBulkImport -
Method Summary
Modifier and TypeMethodDescriptionvoidabort(TransactionKey transactionKey) voidbegin(TransactionKey transactionKey) booleancheckQuerySupport(String language) Checks whether the storage support the given type of query or notvoidclose()Shuts down the storage.voidcommit(TransactionKey transactionKey) voiddelete(ItemPath itemPath, String path, TransactionKey transactionKey) Remove a CRISTAL local object from storage.voiddelete(ItemPath itemPath, 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.executeQuery(Query query, TransactionKey transactionKey) Executes an SQL/OQL/XQuery/XPath/etc query in the target database.get(ItemPath itemPath, String path, TransactionKey transactionKey) Fetches a CRISTAL local object from storage by pathString[]getClusterContents(ItemPath itemPath, String path, TransactionKey transactionKey) Queries the local path below of the item and returns the possible next elements.protected StringgetFilePath(ItemPath itemPath, String path) 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()protected StringgetResourceName(String path) 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 itemPath, 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
getClusterContents, getClusters, getClusterType, getPath, toString
-
Constructor Details
-
XMLClusterStorage
public XMLClusterStorage() -
XMLClusterStorage
Create new XMLClusterStorage with specific setup, Used in predefined stepBulkImport- Parameters:
root- specify the root directory
-
XMLClusterStorage
Create new XMLClusterStorage with specific setup, Used in predefined stepBulkImport- Parameters:
root- specify the root directoryext- the extension of the files with dot, e.g. '.xml', used to save the cluster content. If it is null the default '.xml' extension is used.useDir- specify if the files should be stored in directories or in single files, e.g. Property.Type,xml If it is null the default is true.
-
-
Method Details
-
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
public void 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
-
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
-
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
-
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
-
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 itemPath, String path, TransactionKey transactionKey) throws PersistencyException Description copied from class:ClusterStorageFetches a CRISTAL local object from storage by path- Specified by:
getin classClusterStorage- Parameters:
itemPath- 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 itemPath, 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:
itemPath- 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
public void delete(ItemPath itemPath, 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:
itemPath- 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
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 itemPath, 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:
itemPath- 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 itemPath, 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:
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 null- Returns:
- A String array of the possible next path elements
- Throws:
PersistencyException- When an error occurred during the query
-
getFilePath
-
getResourceName
-
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
-