diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2014-09-09 12:13:21 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2014-09-09 12:13:21 +0200 |
| commit | da731d2bb81666b9c697d9099da632e7dfcdc0f7 (patch) | |
| tree | 567693c3c48f3d15ecbb2dac4f9db03bb6e58c72 /src/main/java/com/c2kernel/lookup/Path.java | |
| parent | ae1e79e33fd30e3d8bcedbef8891a14a048276d7 (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/lookup/Path.java')
| -rw-r--r-- | src/main/java/com/c2kernel/lookup/Path.java | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/main/java/com/c2kernel/lookup/Path.java b/src/main/java/com/c2kernel/lookup/Path.java index d6be37f..f6993f7 100644 --- a/src/main/java/com/c2kernel/lookup/Path.java +++ b/src/main/java/com/c2kernel/lookup/Path.java @@ -13,8 +13,10 @@ package com.c2kernel.lookup; import java.io.Serializable;
import java.util.ArrayList;
import java.util.StringTokenizer;
+import java.util.UUID;
import com.c2kernel.common.ObjectNotFoundException;
+import com.c2kernel.common.SystemKey;
import com.c2kernel.process.Gateway;
@@ -31,17 +33,16 @@ public abstract class Path implements Serializable public static final short CONTEXT = 1;
public static final short ENTITY = 2;
- // invalid int key
- public static final int INVALID = -1;
-
protected String[] mPath = new String[0];
// slash delimited path
protected String mStringPath = null;
// entity or context
protected short mType = CONTEXT;
- // int syskey (only valid for entity SystemPaths)
- protected int mSysKey = INVALID;
+
+ // item UUID (only valid for ItemPaths and DomainPaths that are aliases for Items)
+ protected UUID mUUID;
+ protected SystemKey mSysKey;
// ior is stored in here when it is resolved
protected org.omg.CORBA.Object mIOR = null;
@@ -102,7 +103,8 @@ public abstract class Path implements Serializable {
mStringPath = null;
mPath = path.clone();
- mSysKey = INVALID;
+ mUUID = null;
+ mSysKey = null;
}
/* string path e.g. /system/d000/d000/d001
@@ -122,7 +124,8 @@ public abstract class Path implements Serializable mPath = (newPath.toArray(mPath));
mStringPath = null;
- mSysKey = INVALID;
+ mUUID = null;
+ mSysKey = null;
}
// lookup sets the IOR
@@ -138,7 +141,8 @@ public abstract class Path implements Serializable {
mStringPath = null;
mPath = (path.getPath().clone());
- mSysKey = INVALID;
+ mUUID = null;
+ mSysKey = null;
}
/*************************************************************************/
@@ -196,11 +200,15 @@ public abstract class Path implements Serializable return mType;
}
- public int getSysKey() {
+ public SystemKey getSystemKey() {
return mSysKey;
}
+
+ public UUID getUUID() {
+ return mUUID;
+ }
- public abstract ItemPath getEntity() throws ObjectNotFoundException;
+ public abstract ItemPath getItemPath() throws ObjectNotFoundException;
@Override
public boolean equals( Object path )
@@ -217,7 +225,7 @@ public abstract class Path implements Serializable StringBuffer comp = new StringBuffer("Components: { ");
for (String element : mPath)
comp.append("'").append(element).append("' ");
- return "Path - dump(): "+comp.toString()+"}\n string="+toString()+"\n int="+getSysKey()+"\n type="+mType;
+ return "Path - dump(): "+comp.toString()+"}\n string="+toString()+"\n uuid="+getUUID()+"\n type="+mType;
}
}
|
