summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/lookup/AgentPath.java
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2014-09-22 16:01:18 +0200
committerAndrew Branson <andrew.branson@cern.ch>2014-09-22 16:02:11 +0200
commita7cefce58cdb0f7f2d0868a1d5ee2f24f3890646 (patch)
tree89c30cdb92d7edae5d735c2d6ef45f890cc7be82 /src/main/java/com/c2kernel/lookup/AgentPath.java
parentcfa70de9ec7745356ed00c1502d5bd55eee14181 (diff)
ItemPath.fromUUIDString unnecessary as ItemPath(String) supports both
plain UUIDs and an /entity prefix. Tightened that up and removed the fromUUIDString method for a simpler API. Also switched AgentPath(String) to a path argument for consistency. New AgentPaths should be created with AgentPath(new ItemPath(), String) instead.
Diffstat (limited to 'src/main/java/com/c2kernel/lookup/AgentPath.java')
-rw-r--r--src/main/java/com/c2kernel/lookup/AgentPath.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/com/c2kernel/lookup/AgentPath.java b/src/main/java/com/c2kernel/lookup/AgentPath.java
index f6d6ca4..9dab6a6 100644
--- a/src/main/java/com/c2kernel/lookup/AgentPath.java
+++ b/src/main/java/com/c2kernel/lookup/AgentPath.java
@@ -64,9 +64,13 @@ public class AgentPath extends ItemPath
mAgentName = agentName;
}
- public AgentPath(String agentName) {
- super();
- mAgentName = agentName;
+ public AgentPath(String path) throws InvalidItemPathException {
+ super(path);
+ try {
+ findAgentName();
+ } catch (ObjectNotFoundException e) {
+ throw new InvalidAgentPathException();
+ }
}
public void setAgentName(String agentID)
@@ -135,7 +139,7 @@ public class AgentPath extends ItemPath
public static AgentPath fromUUIDString(String uuid) throws InvalidAgentPathException {
try {
- return new AgentPath(ItemPath.fromUUIDString(uuid));
+ return new AgentPath(new ItemPath(uuid));
} catch (InvalidItemPathException ex) {
throw new InvalidAgentPathException(ex.getMessage());
}