summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/persistency/ClusterStorage.java
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2012-05-30 08:37:45 +0200
committerAndrew Branson <andrew.branson@cern.ch>2012-05-30 08:37:45 +0200
commitb086f57f56bf0eb9dab9cf321a0f69aaaae84347 (patch)
tree8e6e26e8b7eed6abad7a17b093bdbb55c5e6b1ba /source/com/c2kernel/persistency/ClusterStorage.java
parent22088ae8d2d5ff390518dbe1c4372325ffb3a647 (diff)
Initial Maven Conversion
Diffstat (limited to 'source/com/c2kernel/persistency/ClusterStorage.java')
-rw-r--r--source/com/c2kernel/persistency/ClusterStorage.java104
1 files changed, 0 insertions, 104 deletions
diff --git a/source/com/c2kernel/persistency/ClusterStorage.java b/source/com/c2kernel/persistency/ClusterStorage.java
deleted file mode 100644
index 80fd86d..0000000
--- a/source/com/c2kernel/persistency/ClusterStorage.java
+++ /dev/null
@@ -1,104 +0,0 @@
-
-package com.c2kernel.persistency;
-import com.c2kernel.entity.C2KLocalObject;
-import com.c2kernel.persistency.outcome.Outcome;
-import com.c2kernel.persistency.outcome.Viewpoint;
-import com.c2kernel.utils.Logger;
-
-/** Interface for persistency managers of entities.
- A Cluster is defined as a path under the item
- Each ClusterStorage must support get() and getClusterContents() for clusters they return READ and READWRITE from queryClusterSupport
- and put() and delete() for clusters they return WRITE and READWRITE from queryClusterSupport().
- Unsupported operations should throw a ClusterStorageException.
- If a cluster does not exist, get should return null, and delete should return
- @version $Revision: 1.22 $ $Date: 2006/02/01 13:27:47 $
- @author $Author: abranson $
-*/
-public abstract class ClusterStorage {
-
- public static final short NONE = 0;
- public static final short READ = 1;
- public static final short WRITE = 2;
- public static final short READWRITE = 3;
-
- // Cluster types
- public static final String ROOT = "";
- public static final String PROPERTY = "Property";
- public static final String COLLECTION = "Collection";
- public static final String LIFECYCLE = "LifeCycle";
- public static final String OUTCOME = "Outcome";
- public static final String HISTORY = "AuditTrail";
- public static final String VIEWPOINT = "ViewPoint";
- public static final String JOB = "Job";
-
- // connection maintenance
- public abstract void open()
- throws ClusterStorageException;
- public abstract void close()
- throws ClusterStorageException;
-
- // introspection
- public abstract short queryClusterSupport(String clusterType);
- public abstract String getName();
- // for addressing queries
- public abstract String getId();
-
-
- /** Quickly gets the first string of the slashed path */
- public static String getClusterType(String path) {
- try {
- if (path == null || path.length() == 0) return ClusterStorage.ROOT;
- int start = path.charAt(0) == '/' ? 1 : 0;
- int end = path.indexOf('/', start + 1);
- if (end == -1) end = path.length();
- return path.substring(start, end);
- } catch (Exception ex) {
- Logger.error(ex);
- return ClusterStorage.ROOT;
- }
- }
-
- public static String getPath(C2KLocalObject obj) {
- String root = obj.getClusterType();
- if (root == null) return null; // no storage allowed
- if (obj instanceof Outcome) {
- Outcome oc = (Outcome)obj;
- return root+"/"+oc.getSchemaType()+"/"+oc.getSchemaVersion()+"/"+oc.getName();
- }
- else if (obj instanceof Viewpoint) {
- Viewpoint vp = (Viewpoint)obj;
- return root+"/"+vp.getSchemaName()+"/"+vp.getName();
- }
- else
- return root+"/"+obj.getName();
- }
-
- /* object manipulation */
-
- // retrieve object by path
- public abstract C2KLocalObject get(Integer sysKey, String path)
- throws ClusterStorageException;
- // store object by path
- public abstract void put(Integer sysKey, C2KLocalObject obj)
- throws ClusterStorageException;
- // delete cluster
- public abstract void delete(Integer sysKey, String path)
- throws ClusterStorageException;
-
- // db specific queries
- public Object query(Object query)
- throws ClusterStorageException {
- throw new ClusterStorageException("Query not supported on this storage");
- }
-
- public String queryToXML(String query, boolean genericFormat)
- throws ClusterStorageException {
- throw new ClusterStorageException("Query not supported on this storage");
- }
-
-
- // directory listing
- public abstract String[] getClusterContents(Integer sysKey, String path)
- throws ClusterStorageException;
-
-}