summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/persistency/ProxyLoader.java
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2014-09-09 12:13:21 +0200
committerAndrew Branson <andrew.branson@cern.ch>2014-09-09 12:13:21 +0200
commitda731d2bb81666b9c697d9099da632e7dfcdc0f7 (patch)
tree567693c3c48f3d15ecbb2dac4f9db03bb6e58c72 /src/main/java/com/c2kernel/persistency/ProxyLoader.java
parentae1e79e33fd30e3d8bcedbef8891a14a048276d7 (diff)
Replaced int sysKey Item identifier with UUID, which is now portable.
ItemPath objects are now used to identify Items throughout the kernel, replacing ints and Integers.
Diffstat (limited to 'src/main/java/com/c2kernel/persistency/ProxyLoader.java')
-rw-r--r--src/main/java/com/c2kernel/persistency/ProxyLoader.java36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/main/java/com/c2kernel/persistency/ProxyLoader.java b/src/main/java/com/c2kernel/persistency/ProxyLoader.java
index 57b91af..9a7f7bd 100644
--- a/src/main/java/com/c2kernel/persistency/ProxyLoader.java
+++ b/src/main/java/com/c2kernel/persistency/ProxyLoader.java
@@ -19,7 +19,7 @@ import com.c2kernel.utils.Logger;
*/
public class ProxyLoader extends ClusterStorage {
- HashMap<Integer, Item> entities = new HashMap<Integer, Item>();
+ HashMap<ItemPath, Item> entities = new HashMap<ItemPath, Item>();
Lookup lookup;
@Override
@@ -48,14 +48,14 @@ public class ProxyLoader extends ClusterStorage {
// retrieve object by path
@Override
- public C2KLocalObject get(Integer sysKey, String path) throws ClusterStorageException {
+ public C2KLocalObject get(ItemPath thisItem, String path) throws ClusterStorageException {
try {
- Item thisEntity = getIOR(sysKey);
+ Item thisEntity = getIOR(thisItem);
String type = getClusterType(path);
// fetch the xml from the item
String queryData = thisEntity.queryData(path);
- if (Logger.doLog(6)) Logger.msg(6, "ProxyLoader - "+sysKey+":"+path+" = "+queryData);
+ if (Logger.doLog(6)) Logger.msg(6, "ProxyLoader - "+thisItem+":"+path+" = "+queryData);
if (queryData != null) {
if (type.equals(OUTCOME))
@@ -74,13 +74,13 @@ public class ProxyLoader extends ClusterStorage {
// store object by path
@Override
- public void put(Integer sysKey, C2KLocalObject obj) throws ClusterStorageException {
+ public void put(ItemPath thisItem, C2KLocalObject obj) throws ClusterStorageException {
// not supported
throw new ClusterStorageException("Cannot write to items through the ProxyLoader");
}
// delete cluster
@Override
- public void delete(Integer sysKey, String path) throws ClusterStorageException {
+ public void delete(ItemPath thisItem, String path) throws ClusterStorageException {
// not supported
throw new ClusterStorageException("Cannot write to items through the ProxyLoader");
}
@@ -89,9 +89,9 @@ public class ProxyLoader extends ClusterStorage {
// directory listing
@Override
- public String[] getClusterContents(Integer sysKey, String path) throws ClusterStorageException {
+ public String[] getClusterContents(ItemPath thisItem, String path) throws ClusterStorageException {
try {
- Item thisEntity = getIOR(sysKey);
+ Item thisEntity = getIOR(thisItem);
String contents = thisEntity.queryData(path+"/all");
StringTokenizer tok = new StringTokenizer(contents, ",");
String[] result = new String[tok.countTokens()];
@@ -105,16 +105,16 @@ public class ProxyLoader extends ClusterStorage {
}
}
- private Item getIOR(Integer sysKey) throws ClusterStorageException {
- if (entities.containsKey(sysKey)) {
+ private Item getIOR(ItemPath thisPath) throws ClusterStorageException {
+ if (entities.containsKey(thisPath)) {
// check the cache
- Logger.msg(7, "ProxyLoader.getIOR() - "+sysKey+" cached.");
- return entities.get(sysKey);
+ Logger.msg(7, "ProxyLoader.getIOR() - "+thisPath+" cached.");
+ return entities.get(thisPath);
}
try {
- Logger.msg(7, "ProxyLoader.getIOR() - Resolving "+sysKey+".");
- org.omg.CORBA.Object ior = lookup.resolve(new ItemPath(sysKey.intValue()));
+ Logger.msg(7, "ProxyLoader.getIOR() - Resolving "+thisPath+".");
+ org.omg.CORBA.Object ior = lookup.resolve(thisPath);
Item thisItem = null;
try {
@@ -123,15 +123,15 @@ public class ProxyLoader extends ClusterStorage {
try {
thisItem = AgentHelper.narrow(ior);
} catch (org.omg.CORBA.BAD_PARAM ex2) {
- throw new ClusterStorageException ("Could not narrow "+sysKey+" as a known Entity type");
+ throw new ClusterStorageException ("Could not narrow "+thisItem+" as a known Entity type");
}
}
- Logger.msg(7, "ProxyLoader.getIOR() - Found "+sysKey+".");
- entities.put(sysKey, thisItem);
+ Logger.msg(7, "ProxyLoader.getIOR() - Found "+thisItem+".");
+ entities.put(thisPath, thisItem);
return thisItem;
} catch (Exception e) {
- throw new ClusterStorageException("Error narrowing "+sysKey+": "+e.getMessage());
+ throw new ClusterStorageException("Error narrowing "+thisPath+": "+e.getMessage());
}
}
}