ClusterStorage - cristal-ise/kernel GitHub Wiki
Persistency in CRISTAL is implemented using ClusterStorage objects, which are organized using the ClusterStorageManager. Almost every piece of data associated with a CRISTAL Entity (Item or Agent) are stored this way, except for its Lookup data (ItemPaths and DomainPaths).
ClusterStorages declare their support for reading and/or writing one or more types of C2KLocalObject. Each type is stored under a particular path pattern. The:
C2KLocalObject type | Storage Path |
---|---|
Property | /Property/Name |
Collection | /Collection/Collection version/Name |
Workflow | /LifeCycle/Workflow |
Outcome | /Outcome/Schema Name/Schema Version/Event ID |
OutcomeAttachment | /Attachment/Schema Name/Schema Version/Event ID |
Event | /AuditTrail/Event ID |
Viewpoint | /ViewPoint/Schema Name/View Name |
Job (Agents only) | /Job/Job ID |
ClusterStorage implementations must be able to return an identical object to that passed to its put()
method when its path is passed to its get()
method. Fields that should be persisted to achieve this are listed in the classes mapfile, except for Outcomes, for which the storage of the Outcome XML fragment is sufficient.
ClusterStorage is an abstract class in the org.cristalise.kernel.persistency package which must be extended by all ClusterStorages. It defines constants used in ClusterStorage management, String constants for the first path component of each Cluster, and a minimal set of methods to implement:
getName()
,getID()
- return the description and short name of the storage. These values will identify the storage in logs.open()
- initialize the storage at startupclose()
- close the storage for shutdownshort queryClusterSupport(String clusterType)
- for each C2KLocalObject type supported, the object should return the constants READ, WRITE or READWRITE, depending on what it can do with those objects. For all other strings it should return NONE. The ClusterStorageManager will only call get() on that storage for types reported as READ or READWRITE and put/delete() for those reported as WRITE or READWRITE.C2KLocalObject get(Integer sysKey, String path)
- bring the object stored in the Entity with the given system key, under the given path out of persistency and return it.put(Integer sysKey, C2KLocalObject obj)
- store the given object of the Entity with the given system key under the relevant path.delete(Integer sysKey, Path obj)
- delete the object stored in the Entity with the given system key, under the given path.
There are two methods to support execution of Query:
boolean checkQuerySupport(String language)
- Checks is the Query is supported by the ClusterStorage implementation.String executeQuery(Query query)
- Perform a query and return the result as an XML. AgenProxy.execute(job) validates the result agains the Schema associated with the Job.