summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/lookup
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2014-10-03 17:30:41 +0200
committerAndrew Branson <andrew.branson@cern.ch>2014-10-03 17:30:41 +0200
commit275d0bbf555c8917be82ce4cc21eb4cabb00f4c5 (patch)
treeddcc6b14077d90d1b970b67829f07120547dbb62 /src/main/java/com/c2kernel/lookup
parenta139f95bfeca603333b8c0310ae09c6805e58584 (diff)
Huge exception overhaul: Merged ClusterStorageException with
PersistencyException. Replaced MembershipException with InvalidCollectionModification CORBA Exception. Made all predef steps throw more accurate exceptions when they go wrong, and let more exceptions bubble through from underneath.
Diffstat (limited to 'src/main/java/com/c2kernel/lookup')
-rw-r--r--src/main/java/com/c2kernel/lookup/AgentPath.java16
-rw-r--r--src/main/java/com/c2kernel/lookup/DomainPath.java8
-rw-r--r--src/main/java/com/c2kernel/lookup/ItemPath.java4
-rw-r--r--src/main/java/com/c2kernel/lookup/Lookup.java30
-rw-r--r--src/main/java/com/c2kernel/lookup/LookupManager.java32
-rw-r--r--src/main/java/com/c2kernel/lookup/Path.java6
-rw-r--r--src/main/java/com/c2kernel/lookup/RolePath.java12
7 files changed, 54 insertions, 54 deletions
diff --git a/src/main/java/com/c2kernel/lookup/AgentPath.java b/src/main/java/com/c2kernel/lookup/AgentPath.java
index d2a6c7f..06be6d4 100644
--- a/src/main/java/com/c2kernel/lookup/AgentPath.java
+++ b/src/main/java/com/c2kernel/lookup/AgentPath.java
@@ -26,7 +26,7 @@ import java.util.UUID;
import org.apache.xerces.impl.dv.util.Base64;
-import com.c2kernel.common.ObjectNotFoundException;
+import com.c2kernel.common.ObjectNotFound;
import com.c2kernel.common.SystemKey;
import com.c2kernel.process.Gateway;
@@ -47,7 +47,7 @@ public class AgentPath extends ItemPath
super(syskey);
try {
findAgentName();
- } catch (ObjectNotFoundException e) {
+ } catch (ObjectNotFound e) {
throw new InvalidAgentPathException();
}
}
@@ -55,7 +55,7 @@ public class AgentPath extends ItemPath
super(uuid);
try {
findAgentName();
- } catch (ObjectNotFoundException e) {
+ } catch (ObjectNotFound e) {
throw new InvalidAgentPathException();
}
}
@@ -64,7 +64,7 @@ public class AgentPath extends ItemPath
super(itemPath.mUUID);
try {
findAgentName();
- } catch (ObjectNotFoundException e) {
+ } catch (ObjectNotFound e) {
throw new InvalidAgentPathException();
}
}
@@ -78,7 +78,7 @@ public class AgentPath extends ItemPath
super(path);
try {
findAgentName();
- } catch (ObjectNotFoundException e) {
+ } catch (ObjectNotFound e) {
throw new InvalidAgentPathException();
}
}
@@ -93,13 +93,13 @@ public class AgentPath extends ItemPath
if (mAgentName==null)
try {
findAgentName();
- } catch (ObjectNotFoundException e) {
+ } catch (ObjectNotFound e) {
return null;
}
return mAgentName;
}
- private void findAgentName() throws ObjectNotFoundException {
+ private void findAgentName() throws ObjectNotFound {
mAgentName = Gateway.getLookup().getAgentName(this);
}
@@ -115,7 +115,7 @@ public class AgentPath extends ItemPath
public boolean hasRole(String role) {
try {
return hasRole(Gateway.getLookup().getRolePath(role));
- } catch (ObjectNotFoundException ex) {
+ } catch (ObjectNotFound ex) {
return false;
}
}
diff --git a/src/main/java/com/c2kernel/lookup/DomainPath.java b/src/main/java/com/c2kernel/lookup/DomainPath.java
index f1fad5a..1a86b57 100644
--- a/src/main/java/com/c2kernel/lookup/DomainPath.java
+++ b/src/main/java/com/c2kernel/lookup/DomainPath.java
@@ -20,7 +20,7 @@
*/
package com.c2kernel.lookup;
-import com.c2kernel.common.ObjectNotFoundException;
+import com.c2kernel.common.ObjectNotFound;
import com.c2kernel.process.Gateway;
@@ -95,13 +95,13 @@ public class DomainPath extends Path
}
@Override
- public ItemPath getItemPath() throws ObjectNotFoundException {
+ public ItemPath getItemPath() throws ObjectNotFound {
if (mType == UNKNOWN) { // must decide
checkType();
}
if (target == null)
- throw new ObjectNotFoundException("Path "+toString()+" does not resolve to an Item", "");
+ throw new ObjectNotFound("Path "+toString()+" does not resolve to an Item");
return target;
}
@@ -118,7 +118,7 @@ public class DomainPath extends Path
setItemPath(Gateway.getLookup().resolvePath(this));
} catch (InvalidItemPathException ex) {
mType = CONTEXT;
- } catch (ObjectNotFoundException ex) {
+ } catch (ObjectNotFound ex) {
mType = CONTEXT;
}
diff --git a/src/main/java/com/c2kernel/lookup/ItemPath.java b/src/main/java/com/c2kernel/lookup/ItemPath.java
index 855a5dd..ad13854 100644
--- a/src/main/java/com/c2kernel/lookup/ItemPath.java
+++ b/src/main/java/com/c2kernel/lookup/ItemPath.java
@@ -24,7 +24,7 @@ import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.UUID;
-import com.c2kernel.common.ObjectNotFoundException;
+import com.c2kernel.common.ObjectNotFound;
import com.c2kernel.common.SystemKey;
@@ -86,7 +86,7 @@ public class ItemPath extends Path
}
@Override
- public ItemPath getItemPath() throws ObjectNotFoundException {
+ public ItemPath getItemPath() throws ObjectNotFound {
return this;
}
diff --git a/src/main/java/com/c2kernel/lookup/Lookup.java b/src/main/java/com/c2kernel/lookup/Lookup.java
index 924057a..f7e4f59 100644
--- a/src/main/java/com/c2kernel/lookup/Lookup.java
+++ b/src/main/java/com/c2kernel/lookup/Lookup.java
@@ -22,7 +22,7 @@ package com.c2kernel.lookup;
import java.util.Iterator;
-import com.c2kernel.common.ObjectNotFoundException;
+import com.c2kernel.common.ObjectNotFound;
import com.c2kernel.process.auth.Authenticator;
import com.c2kernel.property.Property;
import com.c2kernel.property.PropertyDescriptionList;
@@ -53,9 +53,9 @@ public interface Lookup {
* @param sysKey The system key of the Item
* @return an ItemPath or AgentPath
* @throws InvalidItemPathException When the system key is invalid/out-of-range
- * @throws ObjectNotFoundException When the Item does not exist in the directory.
+ * @throws ObjectNotFound When the Item does not exist in the directory.
*/
- public ItemPath getItemPath(String sysKey) throws InvalidItemPathException, ObjectNotFoundException;
+ public ItemPath getItemPath(String sysKey) throws InvalidItemPathException, ObjectNotFound;
/**
* Find the ItemPath for which a DomainPath is an alias.
@@ -63,18 +63,18 @@ public interface Lookup {
* @param domainPath The path to resolve
* @return The ItemPath it points to (should be an AgentPath if the path references an Agent)
* @throws InvalidItemPathException
- * @throws ObjectNotFoundException
+ * @throws ObjectNotFound
*/
- public ItemPath resolvePath(DomainPath domainPath) throws InvalidItemPathException, ObjectNotFoundException;
+ public ItemPath resolvePath(DomainPath domainPath) throws InvalidItemPathException, ObjectNotFound;
/**
* Resolve a path to a CORBA Object Item or Agent
*
* @param path The path to be resolved
* @return The CORBA Object
- * @throws ObjectNotFoundException When the Path doesn't exist, or doesn't have an IOR associated with it
+ * @throws ObjectNotFound When the Path doesn't exist, or doesn't have an IOR associated with it
*/
- public org.omg.CORBA.Object resolve(Path path) throws ObjectNotFoundException;
+ public org.omg.CORBA.Object resolve(Path path) throws ObjectNotFound;
// Path finding and searching
@@ -131,23 +131,23 @@ public interface Lookup {
/**
* @param agentName
* @return
- * @throws ObjectNotFoundException
+ * @throws ObjectNotFound
*/
- public AgentPath getAgentPath(String agentName) throws ObjectNotFoundException;
+ public AgentPath getAgentPath(String agentName) throws ObjectNotFound;
/**
* @param roleName
* @return
- * @throws ObjectNotFoundException
+ * @throws ObjectNotFound
*/
- public RolePath getRolePath(String roleName) throws ObjectNotFoundException;
+ public RolePath getRolePath(String roleName) throws ObjectNotFound;
/**
* @param rolePath
* @return
- * @throws ObjectNotFoundException
+ * @throws ObjectNotFound
*/
- public AgentPath[] getAgents(RolePath rolePath) throws ObjectNotFoundException;
+ public AgentPath[] getAgents(RolePath rolePath) throws ObjectNotFound;
/**
* @param agentPath
@@ -167,8 +167,8 @@ public interface Lookup {
/**
* @param agentPath
* @return
- * @throws ObjectNotFoundException
+ * @throws ObjectNotFound
*/
- public String getAgentName(AgentPath agentPath) throws ObjectNotFoundException;
+ public String getAgentName(AgentPath agentPath) throws ObjectNotFound;
}
diff --git a/src/main/java/com/c2kernel/lookup/LookupManager.java b/src/main/java/com/c2kernel/lookup/LookupManager.java
index b05a4a4..620c522 100644
--- a/src/main/java/com/c2kernel/lookup/LookupManager.java
+++ b/src/main/java/com/c2kernel/lookup/LookupManager.java
@@ -22,9 +22,9 @@ package com.c2kernel.lookup;
import java.security.NoSuchAlgorithmException;
-import com.c2kernel.common.ObjectAlreadyExistsException;
+import com.c2kernel.common.ObjectAlreadyExists;
import com.c2kernel.common.ObjectCannotBeUpdated;
-import com.c2kernel.common.ObjectNotFoundException;
+import com.c2kernel.common.ObjectNotFound;
/**
* @author abranson
@@ -35,9 +35,9 @@ public interface LookupManager extends Lookup {
/**
* Called when a server starts up. The Lookup implementation should ensure that the initial structure of its directory is valid, and create it on first boot.
*
- * @throws ObjectNotFoundException When initialization data is not found
+ * @throws ObjectNotFound When initialization data is not found
*/
- public void initializeDirectory() throws ObjectNotFoundException;
+ public void initializeDirectory() throws ObjectNotFound;
// Path management
@@ -46,9 +46,9 @@ public interface LookupManager extends Lookup {
*
* @param newPath The path to add
* @throws ObjectCannotBeUpdated When there is an error writing to the directory
- * @throws ObjectAlreadyExistsException When the Path has already been registered
+ * @throws ObjectAlreadyExists When the Path has already been registered
*/
- public void add(Path newPath) throws ObjectCannotBeUpdated, ObjectAlreadyExistsException;
+ public void add(Path newPath) throws ObjectCannotBeUpdated, ObjectAlreadyExists;
/**
* Remove a Path from the directory
@@ -65,10 +65,10 @@ public interface LookupManager extends Lookup {
* @param role
* @param hasJobList
* @return
- * @throws ObjectAlreadyExistsException
+ * @throws ObjectAlreadyExists
* @throws ObjectCannotBeUpdated
*/
- public RolePath createRole(RolePath role) throws ObjectAlreadyExistsException, ObjectCannotBeUpdated;
+ public RolePath createRole(RolePath role) throws ObjectAlreadyExists, ObjectCannotBeUpdated;
/**
* Adds the given Agent to the given Role, if they both exist.
@@ -76,9 +76,9 @@ public interface LookupManager extends Lookup {
* @param agent - the
* @param rolePath
* @throws ObjectCannotBeUpdated
- * @throws ObjectNotFoundException
+ * @throws ObjectNotFound
*/
- public void addRole(AgentPath agent, RolePath rolePath) throws ObjectCannotBeUpdated, ObjectNotFoundException;
+ public void addRole(AgentPath agent, RolePath rolePath) throws ObjectCannotBeUpdated, ObjectNotFound;
/**
* Removes the given Agent from the given Role. Does not delete the Role.
@@ -86,26 +86,26 @@ public interface LookupManager extends Lookup {
* @param agent
* @param role
* @throws ObjectCannotBeUpdated
- * @throws ObjectNotFoundException
+ * @throws ObjectNotFound
*/
- public void removeRole(AgentPath agent, RolePath role) throws ObjectCannotBeUpdated, ObjectNotFoundException;
+ public void removeRole(AgentPath agent, RolePath role) throws ObjectCannotBeUpdated, ObjectNotFound;
/**
* @param agent
* @param newPassword
- * @throws ObjectNotFoundException
+ * @throws ObjectNotFound
* @throws ObjectCannotBeUpdated
* @throws NoSuchAlgorithmException
*/
- public void setAgentPassword(AgentPath agent, String newPassword) throws ObjectNotFoundException, ObjectCannotBeUpdated, NoSuchAlgorithmException;
+ public void setAgentPassword(AgentPath agent, String newPassword) throws ObjectNotFound, ObjectCannotBeUpdated, NoSuchAlgorithmException;
/**
* @param role
* @param hasJobList
- * @throws ObjectNotFoundException
+ * @throws ObjectNotFound
* @throws ObjectCannotBeUpdated
*/
- public void setHasJobList(RolePath role, boolean hasJobList) throws ObjectNotFoundException, ObjectCannotBeUpdated;
+ public void setHasJobList(RolePath role, boolean hasJobList) throws ObjectNotFound, ObjectCannotBeUpdated;
}
diff --git a/src/main/java/com/c2kernel/lookup/Path.java b/src/main/java/com/c2kernel/lookup/Path.java
index 3ccdb35..7085a36 100644
--- a/src/main/java/com/c2kernel/lookup/Path.java
+++ b/src/main/java/com/c2kernel/lookup/Path.java
@@ -24,7 +24,7 @@ import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.UUID;
-import com.c2kernel.common.ObjectNotFoundException;
+import com.c2kernel.common.ObjectNotFound;
import com.c2kernel.common.SystemKey;
import com.c2kernel.process.Gateway;
@@ -194,7 +194,7 @@ public abstract class Path
Lookup myLookup = Gateway.getLookup();
try {
newIOR = myLookup.resolve(this);
- } catch (ObjectNotFoundException ex) {
+ } catch (ObjectNotFound ex) {
}
setIOR(newIOR);
}
@@ -218,7 +218,7 @@ public abstract class Path
return mUUID;
}
- public abstract ItemPath getItemPath() throws ObjectNotFoundException;
+ public abstract ItemPath getItemPath() throws ObjectNotFound;
@Override
public boolean equals( Object path )
diff --git a/src/main/java/com/c2kernel/lookup/RolePath.java b/src/main/java/com/c2kernel/lookup/RolePath.java
index 7432171..97682ab 100644
--- a/src/main/java/com/c2kernel/lookup/RolePath.java
+++ b/src/main/java/com/c2kernel/lookup/RolePath.java
@@ -22,9 +22,9 @@ package com.c2kernel.lookup;
import java.util.Iterator;
-import com.c2kernel.common.CannotManageException;
+import com.c2kernel.common.CannotManage;
import com.c2kernel.common.ObjectCannotBeUpdated;
-import com.c2kernel.common.ObjectNotFoundException;
+import com.c2kernel.common.ObjectNotFound;
import com.c2kernel.process.Gateway;
@@ -50,7 +50,7 @@ public class RolePath extends DomainPath
try {
if (mPath.length > 2)
return Gateway.getLookup().getRolePath(mPath[mPath.length-2]);
- } catch (ObjectNotFoundException ex) { }
+ } catch (ObjectNotFound ex) { }
return null;
}
@@ -77,10 +77,10 @@ public class RolePath extends DomainPath
/**
* @param hasJobList The hasJobList to set.
* @throws ObjectCannotBeUpdated
- * @throws ObjectNotFoundException
- * @throws CannotManageException
+ * @throws ObjectNotFound
+ * @throws CannotManage
*/
- public void setHasJobList(boolean hasJobList) throws ObjectNotFoundException, ObjectCannotBeUpdated, CannotManageException {
+ public void setHasJobList(boolean hasJobList) throws ObjectNotFound, ObjectCannotBeUpdated, CannotManage {
this.hasJobList = hasJobList;
}