From a7cefce58cdb0f7f2d0868a1d5ee2f24f3890646 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Mon, 22 Sep 2014 16:01:18 +0200 Subject: 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. --- src/main/java/com/c2kernel/lookup/AgentPath.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/main/java/com/c2kernel/lookup/AgentPath.java') 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()); } -- cgit v1.2.3