summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/persistency/ProxyLoader.java
diff options
context:
space:
mode:
Diffstat (limited to 'source/com/c2kernel/persistency/ProxyLoader.java')
-rw-r--r--source/com/c2kernel/persistency/ProxyLoader.java55
1 files changed, 32 insertions, 23 deletions
diff --git a/source/com/c2kernel/persistency/ProxyLoader.java b/source/com/c2kernel/persistency/ProxyLoader.java
index 687141f..e614b0d 100644
--- a/source/com/c2kernel/persistency/ProxyLoader.java
+++ b/source/com/c2kernel/persistency/ProxyLoader.java
@@ -21,38 +21,44 @@ public class ProxyLoader extends ClusterStorage {
HashMap<Integer, ManageableEntity> entities = new HashMap<Integer, ManageableEntity>();
LDAPLookup lookup;
- public void open() throws ClusterStorageException {
+ @Override
+ public void open() throws ClusterStorageException {
lookup = Gateway.getLDAPLookup();
}
- public void close() throws ClusterStorageException {
+ @Override
+ public void close() throws ClusterStorageException {
}
// introspection
- public short queryClusterSupport(String clusterType) {
+ @Override
+ public short queryClusterSupport(String clusterType) {
return READ;
}
- public String getName() {
+ @Override
+ public String getName() {
return "Proxy Cluster Loader";
}
-
- public String getId() {
+
+ @Override
+ public String getId() {
return "CORBA";
}
// retrieve object by path
- public C2KLocalObject get(Integer sysKey, String path) throws ClusterStorageException {
+ @Override
+ public C2KLocalObject get(Integer sysKey, String path) throws ClusterStorageException {
try {
ManageableEntity thisEntity = getIOR(sysKey);
String type = getClusterType(path);
// fetch the xml from the item
String queryData = thisEntity.queryData(path);
-
+
if (queryData != null) {
- if (type.equals(OUTCOME))
+ if (type.equals(OUTCOME))
return new Outcome(path, queryData);
- else
+ else
return (C2KLocalObject)CastorXMLUtility.unmarshall(queryData);
}
} catch (Exception e) {
@@ -61,14 +67,16 @@ public class ProxyLoader extends ClusterStorage {
}
return null;
}
-
+
// store object by path
- public void put(Integer sysKey, C2KLocalObject obj) throws ClusterStorageException {
+ @Override
+ public void put(Integer sysKey, C2KLocalObject obj) throws ClusterStorageException {
// not supported
throw new ClusterStorageException("Cannot write to items through the ProxyLoader");
}
// delete cluster
- public void delete(Integer sysKey, String path) throws ClusterStorageException {
+ @Override
+ public void delete(Integer sysKey, String path) throws ClusterStorageException {
// not supported
throw new ClusterStorageException("Cannot write to items through the ProxyLoader");
}
@@ -76,33 +84,34 @@ public class ProxyLoader extends ClusterStorage {
/* navigation */
// directory listing
- public String[] getClusterContents(Integer sysKey, String path) throws ClusterStorageException {
+ @Override
+ public String[] getClusterContents(Integer sysKey, String path) throws ClusterStorageException {
try {
ManageableEntity thisEntity = getIOR(sysKey);
String contents = thisEntity.queryData(path+"/all");
StringTokenizer tok = new StringTokenizer(contents, ",");
String[] result = new String[tok.countTokens()];
- for (int i=0; i<result.length; i++)
+ for (int i=0; i<result.length; i++)
result[i] = tok.nextToken();
-
+
return result;
} catch (Exception e) {
throw new ClusterStorageException(e.getMessage());
}
}
-
+
private ManageableEntity getIOR(Integer sysKey) throws ClusterStorageException {
if (entities.containsKey(sysKey)) {
// check the cache
Logger.msg(7, "ProxyLoader.getIOR() - "+sysKey+" cached.");
- return (ManageableEntity)entities.get(sysKey);
+ return entities.get(sysKey);
}
-
+
try {
Logger.msg(7, "ProxyLoader.getIOR() - Resolving "+sysKey+".");
-
+
org.omg.CORBA.Object ior = lookup.getIOR(new EntityPath(sysKey.intValue()));
-
+
ManageableEntity thisEntity = null;
try {
thisEntity = ItemHelper.narrow(ior);
@@ -113,7 +122,7 @@ public class ProxyLoader extends ClusterStorage {
throw new ClusterStorageException ("Could not narrow "+sysKey+" as a known Entity type");
}
}
-
+
Logger.msg(7, "ProxyLoader.getIOR() - Found "+sysKey+".");
entities.put(sysKey, thisEntity);
return thisEntity;
@@ -121,4 +130,4 @@ public class ProxyLoader extends ClusterStorage {
throw new ClusterStorageException("Error narrowing "+sysKey+": "+e.getMessage());
}
}
-}
+}