diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2014-09-19 15:40:50 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2014-09-19 15:40:50 +0200 |
| commit | 482b98e869d07802310e249d09d784c63f9a86b6 (patch) | |
| tree | bd6c55d5d5ebf967fb22b5cf1ceb9f3f6a7bbdd9 /src/main/java/com/c2kernel/lookup/AgentPath.java | |
| parent | 3743d182d99dbed9d2be84dc357f6839ffe4d2ec (diff) | |
Introduced static method ItemPath.fromUUIDString and made the UUID
constructor protected to better handle ItemPath and AgentPath
construction with String UUIDs, throwing the right exceptions.
Diffstat (limited to 'src/main/java/com/c2kernel/lookup/AgentPath.java')
| -rw-r--r-- | src/main/java/com/c2kernel/lookup/AgentPath.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/com/c2kernel/lookup/AgentPath.java b/src/main/java/com/c2kernel/lookup/AgentPath.java index fb4ce0e..f6d6ca4 100644 --- a/src/main/java/com/c2kernel/lookup/AgentPath.java +++ b/src/main/java/com/c2kernel/lookup/AgentPath.java @@ -33,7 +33,7 @@ public class AgentPath extends ItemPath private String mAgentName=null;
private String mPassword=null;
- public AgentPath(SystemKey syskey) throws InvalidAgentPathException {
+ public AgentPath(SystemKey syskey) throws InvalidAgentPathException, InvalidItemPathException {
super(syskey);
try {
findAgentName();
@@ -41,7 +41,7 @@ public class AgentPath extends ItemPath throw new InvalidAgentPathException();
}
}
- public AgentPath(UUID uuid) throws InvalidAgentPathException {
+ protected AgentPath(UUID uuid) throws InvalidAgentPathException, InvalidItemPathException {
super(uuid);
try {
findAgentName();
@@ -132,6 +132,14 @@ public class AgentPath extends ItemPath digest.append(Base64.encode(hash));
return digest.toString();
}
+
+ public static AgentPath fromUUIDString(String uuid) throws InvalidAgentPathException {
+ try {
+ return new AgentPath(ItemPath.fromUUIDString(uuid));
+ } catch (InvalidItemPathException ex) {
+ throw new InvalidAgentPathException(ex.getMessage());
+ }
+ }
}
|
