summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/persistency/XMLClusterStorage.java
diff options
context:
space:
mode:
Diffstat (limited to 'source/com/c2kernel/persistency/XMLClusterStorage.java')
-rw-r--r--source/com/c2kernel/persistency/XMLClusterStorage.java37
1 files changed, 23 insertions, 14 deletions
diff --git a/source/com/c2kernel/persistency/XMLClusterStorage.java b/source/com/c2kernel/persistency/XMLClusterStorage.java
index 24697af..277551d 100644
--- a/source/com/c2kernel/persistency/XMLClusterStorage.java
+++ b/source/com/c2kernel/persistency/XMLClusterStorage.java
@@ -17,7 +17,8 @@ public class XMLClusterStorage extends ClusterStorage {
public XMLClusterStorage() {
}
- public void open() throws ClusterStorageException {
+ @Override
+ public void open() throws ClusterStorageException {
String rootProp = Gateway.getProperty("XMLStorage.root");
if (rootProp == null)
throw new ClusterStorageException("XMLClusterStorage.open() - Root path not given in config file.");
@@ -31,33 +32,38 @@ public class XMLClusterStorage extends ClusterStorage {
}
}
- public void close() {
+ @Override
+ public void close() {
rootDir = null;
}
// introspection
- public short queryClusterSupport(String clusterType) {
+ @Override
+ public short queryClusterSupport(String clusterType) {
return ClusterStorage.READWRITE;
}
- public String getName() {
+ @Override
+ public String getName() {
return "XML File Cluster Storage";
}
-
- public String getId() {
+
+ @Override
+ public String getId() {
return "XML";
}
/* object manipulation */
// retrieve object by path
- public C2KLocalObject get(Integer sysKey, String path) throws ClusterStorageException {
+ @Override
+ public C2KLocalObject get(Integer sysKey, String path) throws ClusterStorageException {
try {
String type = ClusterStorage.getClusterType(path);
String filePath = getFilePath(sysKey, path)+".xml";
String objString = FileStringUtility.file2String(filePath);
if (objString.length() == 0) return null;
-
+
if (type.equals("Outcome"))
return new Outcome(path, objString);
else
@@ -70,7 +76,8 @@ public class XMLClusterStorage extends ClusterStorage {
}
// store object by path
- public void put(Integer sysKey, C2KLocalObject obj) throws ClusterStorageException {
+ @Override
+ public void put(Integer sysKey, C2KLocalObject obj) throws ClusterStorageException {
try {
String filePath = getFilePath(sysKey, getPath(obj)+".xml");
Logger.msg(7, "Writing "+filePath);
@@ -89,7 +96,8 @@ public class XMLClusterStorage extends ClusterStorage {
}
// delete cluster
- public void delete(Integer sysKey, String path) throws ClusterStorageException {
+ @Override
+ public void delete(Integer sysKey, String path) throws ClusterStorageException {
try {
String filePath = getFilePath(sysKey, path+".xml");
boolean success = FileStringUtility.deleteDir(filePath, true, true);
@@ -104,11 +112,12 @@ public class XMLClusterStorage extends ClusterStorage {
/* navigation */
// directory listing
- public String[] getClusterContents(Integer sysKey, String path) throws ClusterStorageException {
+ @Override
+ public String[] getClusterContents(Integer sysKey, String path) throws ClusterStorageException {
String[] result = new String[0];
try {
String filePath = getFilePath(sysKey, path);
- ArrayList paths = FileStringUtility.listDir( filePath, true, false );
+ ArrayList<?> paths = FileStringUtility.listDir( filePath, true, false );
if (paths == null) return result; // dir doesn't exist yet
ArrayList<String> contents = new ArrayList<String>();
String previous = null;
@@ -126,8 +135,8 @@ public class XMLClusterStorage extends ClusterStorage {
if (next.indexOf('/') > -1) next = next.substring(next.lastIndexOf('/')+1);
contents.add(next);
}
-
- result = (String[])contents.toArray(result);
+
+ result = contents.toArray(result);
return result;
} catch (Exception e) {
Logger.error(e);