diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2014-10-03 23:18:47 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2014-10-03 23:18:47 +0200 |
| commit | b68ea0f2b12c4c5189c5fc7c182a1b242dc63579 (patch) | |
| tree | 85b1cc4713ba978c044bfa0656f9115c9f9bf9e3 /src/main/java/com/c2kernel/lifecycle/instance/predefined/agent | |
| parent | 275d0bbf555c8917be82ce4cc21eb4cabb00f4c5 (diff) | |
Rolled back the renaming of existing exceptions.
Diffstat (limited to 'src/main/java/com/c2kernel/lifecycle/instance/predefined/agent')
4 files changed, 41 insertions, 41 deletions
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java index 564c5db..a2dfeae 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java @@ -22,11 +22,11 @@ package com.c2kernel.lifecycle.instance.predefined.agent; import java.util.Arrays;
-import com.c2kernel.common.CannotManage;
-import com.c2kernel.common.InvalidData;
-import com.c2kernel.common.ObjectAlreadyExists;
+import com.c2kernel.common.CannotManageException;
+import com.c2kernel.common.InvalidDataException;
+import com.c2kernel.common.ObjectAlreadyExistsException;
import com.c2kernel.common.ObjectCannotBeUpdated;
-import com.c2kernel.common.ObjectNotFound;
+import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.common.PersistencyException;
import com.c2kernel.entity.CorbaServer;
import com.c2kernel.entity.agent.ActiveEntity;
@@ -57,21 +57,21 @@ public class CreateAgentFromDescription extends CreateItemFromDescription * <li>Comma-delimited Role names to assign to the agent. Must already exist.</li>
* <li>Initial properties to set in the new Agent</li>
* </ol>
- * @throws ObjectNotFound
- * @throws InvalidData The input parameters were incorrect
- * @throws ObjectAlreadyExists The Agent already exists
- * @throws CannotManage The Agent could not be created
+ * @throws ObjectNotFoundException
+ * @throws InvalidDataException The input parameters were incorrect
+ * @throws ObjectAlreadyExistsException The Agent already exists
+ * @throws CannotManageException The Agent could not be created
* @throws ObjectCannotBeUpdated The addition of the new entries into the LookupManager failed
* @see com.c2kernel.lifecycle.instance.predefined.item.CreateItemFromDescription#runActivityLogic(com.c2kernel.lookup.AgentPath, int, int, java.lang.String)
*/
@Override
protected String runActivityLogic(AgentPath agent, ItemPath item,
- int transitionID, String requestData) throws ObjectNotFound, InvalidData, ObjectAlreadyExists, CannotManage, ObjectCannotBeUpdated {
+ int transitionID, String requestData) throws ObjectNotFoundException, InvalidDataException, ObjectAlreadyExistsException, CannotManageException, ObjectCannotBeUpdated {
String[] params = getDataList(requestData);
if (Logger.doLog(3)) Logger.msg(3, "CreateAgentFromDescription: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params));
if (params.length < 3 || params.length > 4)
- throw new InvalidData("CreateAgentFromDescription: Invalid parameters "+Arrays.toString(params));
+ throw new InvalidDataException("CreateAgentFromDescription: Invalid parameters "+Arrays.toString(params));
String newName = params[0];
String descVer = params[1];
@@ -90,8 +90,8 @@ public class CreateAgentFromDescription extends CreateItemFromDescription // check if the path is already taken
try {
Gateway.getLookup().getAgentPath(newName);
- throw new ObjectAlreadyExists("The agent name " +newName+ " exists already.");
- } catch (ObjectNotFound ex) { }
+ throw new ObjectAlreadyExistsException("The agent name " +newName+ " exists already.");
+ } catch (ObjectNotFoundException ex) { }
// generate new entity key
Logger.msg(6, "CreateItemFromDescription - Requesting new agent path");
@@ -103,7 +103,7 @@ public class CreateAgentFromDescription extends CreateItemFromDescription // create the Item object
Logger.msg(3, "CreateItemFromDescription - Creating Item");
CorbaServer factory = Gateway.getCorbaServer();
- if (factory == null) throw new CannotManage("This process cannot create new Items");
+ if (factory == null) throw new CannotManageException("This process cannot create new Items");
ActiveEntity newAgent = factory.createAgent(newAgentPath);
Gateway.getLookupManager().add(newAgentPath);
@@ -122,7 +122,7 @@ public class CreateAgentFromDescription extends CreateItemFromDescription // TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
- throw new InvalidData("CreateAgentFromDescription: Problem initializing new Agent. See log: "+e.getMessage());
+ throw new InvalidDataException("CreateAgentFromDescription: Problem initializing new Agent. See log: "+e.getMessage());
}
// add roles if given
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/RemoveAgent.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/RemoveAgent.java index 65608c7..41fc7ba 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/RemoveAgent.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/RemoveAgent.java @@ -20,10 +20,10 @@ */
package com.c2kernel.lifecycle.instance.predefined.agent;
-import com.c2kernel.common.CannotManage;
-import com.c2kernel.common.InvalidData;
+import com.c2kernel.common.CannotManageException;
+import com.c2kernel.common.InvalidDataException;
import com.c2kernel.common.ObjectCannotBeUpdated;
-import com.c2kernel.common.ObjectNotFound;
+import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.common.PersistencyException;
import com.c2kernel.lifecycle.instance.predefined.PredefinedStep;
import com.c2kernel.lookup.AgentPath;
@@ -41,7 +41,7 @@ public class RemoveAgent extends PredefinedStep { @Override
protected String runActivityLogic(AgentPath agent, ItemPath itemPath,
- int transitionID, String requestData) throws InvalidData {
+ int transitionID, String requestData) throws InvalidDataException {
Logger.msg(1, "RemoveAgent::request() - Starting.");
@@ -49,7 +49,7 @@ public class RemoveAgent extends PredefinedStep { try {
targetAgent = new AgentPath(itemPath);
} catch (InvalidAgentPathException ex) {
- throw new InvalidData("Could not resolve "+itemPath+" as an Agent.");
+ throw new InvalidDataException("Could not resolve "+itemPath+" as an Agent.");
}
String agentName = targetAgent.getAgentName();
@@ -59,12 +59,12 @@ public class RemoveAgent extends PredefinedStep { Gateway.getLookupManager().removeRole(targetAgent, role);
} catch (ObjectCannotBeUpdated e) {
Logger.error(e);
- throw new InvalidData("Error removing "+agentName+" from Role "+role.getName());
- } catch (ObjectNotFound e) {
+ throw new InvalidDataException("Error removing "+agentName+" from Role "+role.getName());
+ } catch (ObjectNotFoundException e) {
Logger.error(e);
- throw new InvalidData("Tried to remove "+agentName+" from Role "+role.getName()+" that doesn't exist.");
- } catch (CannotManage e) {
- throw new InvalidData("Tried to alter roles in a non-server process.");
+ throw new InvalidDataException("Tried to remove "+agentName+" from Role "+role.getName()+" that doesn't exist.");
+ } catch (CannotManageException e) {
+ throw new InvalidDataException("Tried to alter roles in a non-server process.");
}
}
@@ -73,14 +73,14 @@ public class RemoveAgent extends PredefinedStep { Gateway.getStorage().removeCluster(targetAgent, "", null);
} catch (PersistencyException e) {
Logger.error(e);
- throw new InvalidData("Error deleting storage for "+agentName);
+ throw new InvalidDataException("Error deleting storage for "+agentName);
}
//remove entity path
try {
Gateway.getLookupManager().delete(targetAgent);
} catch (Exception e) {
- throw new InvalidData("Error deleting AgentPath for "+agentName);
+ throw new InvalidDataException("Error deleting AgentPath for "+agentName);
}
return requestData;
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/SetAgentPassword.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/SetAgentPassword.java index 5285662..f54e2a8 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/SetAgentPassword.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/SetAgentPassword.java @@ -23,10 +23,10 @@ package com.c2kernel.lifecycle.instance.predefined.agent; import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
-import com.c2kernel.common.CannotManage;
-import com.c2kernel.common.InvalidData;
+import com.c2kernel.common.CannotManageException;
+import com.c2kernel.common.InvalidDataException;
import com.c2kernel.common.ObjectCannotBeUpdated;
-import com.c2kernel.common.ObjectNotFound;
+import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.lifecycle.instance.predefined.PredefinedStep;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.lookup.InvalidItemPathException;
@@ -42,17 +42,17 @@ public class SetAgentPassword extends PredefinedStep { @Override
protected String runActivityLogic(AgentPath agent, ItemPath item,
- int transitionID, String requestData) throws InvalidData, ObjectNotFound, ObjectCannotBeUpdated, CannotManage {
+ int transitionID, String requestData) throws InvalidDataException, ObjectNotFoundException, ObjectCannotBeUpdated, CannotManageException {
String[] params = getDataList(requestData);
if (Logger.doLog(3)) Logger.msg(3, "SetAgentPassword: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params));
- if (params.length != 1) throw new InvalidData("SetAgentPassword: Invalid parameters "+Arrays.toString(params));
+ if (params.length != 1) throw new InvalidDataException("SetAgentPassword: Invalid parameters "+Arrays.toString(params));
AgentPath targetAgent;
try {
targetAgent = new AgentPath(item);
} catch (InvalidItemPathException ex) {
- throw new InvalidData("Can only set password on an Agent. "+item+" is an Item.");
+ throw new InvalidDataException("Can only set password on an Agent. "+item+" is an Item.");
}
String agentName = targetAgent.getAgentName();
@@ -60,7 +60,7 @@ public class SetAgentPassword extends PredefinedStep { Gateway.getLookupManager().setAgentPassword(targetAgent, params[0]);
} catch (NoSuchAlgorithmException e) {
Logger.error(e);
- throw new InvalidData("Cryptographic libraries for password hashing not found.");
+ throw new InvalidDataException("Cryptographic libraries for password hashing not found.");
}
params[1] = "REDACTED"; // censor user's password from outcome
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/SetAgentRoles.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/SetAgentRoles.java index 02cc49e..d326d05 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/SetAgentRoles.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/SetAgentRoles.java @@ -22,8 +22,8 @@ package com.c2kernel.lifecycle.instance.predefined.agent; import java.util.ArrayList;
-import com.c2kernel.common.InvalidData;
-import com.c2kernel.common.ObjectNotFound;
+import com.c2kernel.common.InvalidDataException;
+import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.lifecycle.instance.predefined.PredefinedStep;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.lookup.InvalidItemPathException;
@@ -40,7 +40,7 @@ public class SetAgentRoles extends PredefinedStep { @Override
protected String runActivityLogic(AgentPath agent, ItemPath item,
- int transitionID, String requestData) throws InvalidData {
+ int transitionID, String requestData) throws InvalidDataException {
Logger.msg(1, "SetAgentRoles::request() - Starting.");
@@ -49,7 +49,7 @@ public class SetAgentRoles extends PredefinedStep { try {
targetAgent = new AgentPath(item);
} catch (InvalidItemPathException ex) {
- throw new InvalidData("Could not resolve syskey "+item+" as an Agent.");
+ throw new InvalidDataException("Could not resolve syskey "+item+" as an Agent.");
}
RolePath[] currentRoles = targetAgent.getRoles();
@@ -57,8 +57,8 @@ public class SetAgentRoles extends PredefinedStep { for (int i=0; i<params.length; i++)
try {
requestedRoles.add(Gateway.getLookup().getRolePath(params[i]));
- } catch (ObjectNotFound e) {
- throw new InvalidData("Role "+params[i]+" not found");
+ } catch (ObjectNotFoundException e) {
+ throw new InvalidDataException("Role "+params[i]+" not found");
}
ArrayList<RolePath> rolesToRemove = new ArrayList<RolePath>();
@@ -75,7 +75,7 @@ public class SetAgentRoles extends PredefinedStep { Gateway.getLookupManager().removeRole(targetAgent, roleToRemove);
} catch (Exception e) {
Logger.error(e);
- throw new InvalidData("Error removing role "+roleToRemove.getName());
+ throw new InvalidDataException("Error removing role "+roleToRemove.getName());
}
// add requested roles we don't already have
@@ -84,7 +84,7 @@ public class SetAgentRoles extends PredefinedStep { Gateway.getLookupManager().addRole(targetAgent, roleToAdd);
} catch (Exception e) {
Logger.error(e);
- throw new InvalidData("Error adding role "+roleToAdd.getName());
+ throw new InvalidDataException("Error adding role "+roleToAdd.getName());
}
return requestData;
|
