summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/lookup/NextKeyManager.java
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2014-05-07 17:33:13 +0200
committerAndrew Branson <andrew.branson@cern.ch>2014-05-08 16:37:39 +0200
commita1f0ecbb6a2bea6aa214322c412af2f3c5ce124b (patch)
tree4d74229b6dd9cfd7ce054e06bf740b9a63a578d6 /src/main/java/com/c2kernel/lookup/NextKeyManager.java
parent6dfa1bbe05a712174e937af89d5223e98d9d7d06 (diff)
Agent now extends Item, so they can have workflows. All traces of the
old 'Entity' superclasses should be removed, including proxies and paths. Very large change, breaks API compatibility with CRISTAL 2.x. Fixes #135
Diffstat (limited to 'src/main/java/com/c2kernel/lookup/NextKeyManager.java')
-rw-r--r--src/main/java/com/c2kernel/lookup/NextKeyManager.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main/java/com/c2kernel/lookup/NextKeyManager.java b/src/main/java/com/c2kernel/lookup/NextKeyManager.java
index a4ead4b..9aea50d 100644
--- a/src/main/java/com/c2kernel/lookup/NextKeyManager.java
+++ b/src/main/java/com/c2kernel/lookup/NextKeyManager.java
@@ -28,14 +28,14 @@ public class NextKeyManager {
this.lastKeyPath = lastKeyPath;
}
- public synchronized EntityPath generateNextEntityKey()
+ public synchronized ItemPath generateNextEntityKey()
throws ObjectCannotBeUpdated, ObjectNotFoundException
{
- EntityPath lastKey = getLastEntityPath();
+ ItemPath lastKey = getLastEntityPath();
try {
lastKey.setSysKey(lastKey.getSysKey()+1);
- } catch (InvalidEntityPathException ex) {
+ } catch (InvalidItemPathException ex) {
throw new ObjectCannotBeUpdated("Invalid syskey "+(lastKey.getSysKey()+1)+". Maybe centre is full.");
}
//test that storage is empty for that key
@@ -56,7 +56,7 @@ public class NextKeyManager {
public synchronized AgentPath generateNextAgentKey()
throws ObjectCannotBeUpdated, ObjectNotFoundException {
- EntityPath newEntity = generateNextEntityKey();
+ ItemPath newEntity = generateNextEntityKey();
return new AgentPath(newEntity);
}
@@ -65,15 +65,15 @@ public class NextKeyManager {
LDAPLookupUtils.setAttributeValue(ldap.getConnection(), lastKeyEntry,"intsyskey",Integer.toString(sysKey));
}
- public EntityPath getLastEntityPath() throws ObjectNotFoundException
+ public ItemPath getLastEntityPath() throws ObjectNotFoundException
{
LDAPEntry lastKeyEntry = LDAPLookupUtils.getEntry(ldap.getConnection(),lastKeyPath);
String lastKey = LDAPLookupUtils.getFirstAttributeValue(lastKeyEntry,"intsyskey");
try {
int sysKey = Integer.parseInt(lastKey);
- EntityPath sysPath = new EntityPath(sysKey);
+ ItemPath sysPath = new ItemPath(sysKey);
return sysPath;
- } catch (InvalidEntityPathException ex) {
+ } catch (InvalidItemPathException ex) {
throw new ObjectNotFoundException("Invalid syskey. Maybe centre is full.");
} catch (NumberFormatException ex) {
throw new ObjectNotFoundException("Invalid syskey in lastkey.");