From b68ea0f2b12c4c5189c5fc7c182a1b242dc63579 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 3 Oct 2014 23:18:47 +0200 Subject: Rolled back the renaming of existing exceptions. --- .../com/c2kernel/lifecycle/instance/Activity.java | 92 +++++++++++----------- .../lifecycle/instance/AdvancementCalculator.java | 6 +- .../com/c2kernel/lifecycle/instance/AndSplit.java | 4 +- .../lifecycle/instance/CompositeActivity.java | 36 ++++----- .../java/com/c2kernel/lifecycle/instance/Join.java | 34 ++++---- .../java/com/c2kernel/lifecycle/instance/Loop.java | 8 +- .../com/c2kernel/lifecycle/instance/OrSplit.java | 8 +- .../com/c2kernel/lifecycle/instance/Split.java | 32 ++++---- .../com/c2kernel/lifecycle/instance/WfVertex.java | 48 +++++------ .../com/c2kernel/lifecycle/instance/Workflow.java | 42 +++++----- .../com/c2kernel/lifecycle/instance/XOrSplit.java | 10 +-- .../instance/predefined/AddC2KObject.java | 8 +- .../instance/predefined/AddDomainPath.java | 10 +-- .../instance/predefined/AddMemberToCollection.java | 16 ++-- .../predefined/AddNewCollectionDescription.java | 16 ++-- .../lifecycle/instance/predefined/AddNewSlot.java | 14 ++-- .../instance/predefined/AssignItemToSlot.java | 14 ++-- .../lifecycle/instance/predefined/ClearSlot.java | 12 +-- .../lifecycle/instance/predefined/Import.java | 6 +- .../instance/predefined/RemoveC2KObject.java | 6 +- .../instance/predefined/RemoveDomainPath.java | 18 ++--- .../predefined/RemoveSlotFromCollection.java | 16 ++-- .../instance/predefined/ReplaceDomainWorkflow.java | 8 +- .../instance/predefined/WriteProperty.java | 12 +-- .../instance/predefined/WriteViewpoint.java | 10 +-- .../agent/CreateAgentFromDescription.java | 28 +++---- .../instance/predefined/agent/RemoveAgent.java | 24 +++--- .../predefined/agent/SetAgentPassword.java | 14 ++-- .../instance/predefined/agent/SetAgentRoles.java | 16 ++-- .../predefined/item/CreateItemFromDescription.java | 38 ++++----- .../lifecycle/instance/predefined/item/Erase.java | 8 +- .../predefined/server/AddDomainContext.java | 12 +-- .../instance/predefined/server/CreateNewAgent.java | 14 ++-- .../instance/predefined/server/CreateNewItem.java | 12 +-- .../instance/predefined/server/CreateNewRole.java | 12 +-- .../predefined/server/RemoveDomainContext.java | 16 ++-- .../instance/predefined/server/RemoveRole.java | 10 +-- .../instance/stateMachine/StateMachine.java | 12 +-- .../instance/stateMachine/Transition.java | 14 ++-- 39 files changed, 358 insertions(+), 358 deletions(-) (limited to 'src/main/java/com/c2kernel/lifecycle/instance') diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Activity.java b/src/main/java/com/c2kernel/lifecycle/instance/Activity.java index 70b991d..4dfe6ca 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Activity.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Activity.java @@ -26,14 +26,14 @@ import java.util.Map; import java.util.Vector; import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.CannotManage; +import com.c2kernel.common.CannotManageException; import com.c2kernel.common.GTimeStamp; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +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.agent.Job; import com.c2kernel.events.Event; @@ -103,13 +103,13 @@ public class Activity extends WfVertex return new Next(this, vertex); } - public StateMachine getStateMachine() throws InvalidData { + public StateMachine getStateMachine() throws InvalidDataException { if (machine == null) { String name = (String)getProperties().get("StateMachineName"); int version = getVersionNumberProperty("StateMachineVersion"); try { machine = LocalObjectLoader.getStateMachine(name, version); - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { if (name.equals(getDefaultSMName()) && version == 0) { // default state machine not imported yet. Fake it. try { String marshalledSM = Gateway.getResource().getTextResource(null, "boot/SM/"+getDefaultSMName()+".xml"); @@ -119,24 +119,24 @@ public class Activity extends WfVertex return bootstrap; } catch (Exception ex2) { Logger.error(ex2); - throw new InvalidData("Could not bootstrap default state machine from resources."); + throw new InvalidDataException("Could not bootstrap default state machine from resources."); } } Logger.error(ex); - throw new InvalidData("Error loading state machine '"+name+"' v"+version); + throw new InvalidDataException("Error loading state machine '"+name+"' v"+version); } } return machine; } /** return the current State of the State machine (Used in Serialisation) */ - public int getState() throws InvalidData + public int getState() throws InvalidDataException { if (state == -1) state = getStateMachine().getInitialStateCode(); return state; } - public String getStateName() throws InvalidData + public String getStateName() throws InvalidDataException { return getStateMachine().getState(getState()).getName(); } @@ -147,19 +147,19 @@ public class Activity extends WfVertex this.state = state; } - public boolean isFinished() throws InvalidData { + public boolean isFinished() throws InvalidDataException { return getStateMachine().getState(getState()).isFinished(); } /** cf Item request - * @throws ObjectNotFound + * @throws ObjectNotFoundException * @throws PersistencyException - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated - * @throws CannotManage + * @throws CannotManageException * @throws InvalidCollectionModification */ - public String request(AgentPath agent, ItemPath itemPath, int transitionID, String requestData) throws AccessRightsException, InvalidTransition, InvalidData, ObjectNotFound, PersistencyException, ObjectAlreadyExists, ObjectCannotBeUpdated, CannotManage, InvalidCollectionModification + public String request(AgentPath agent, ItemPath itemPath, int transitionID, String requestData) throws AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectNotFoundException, PersistencyException, ObjectAlreadyExistsException, ObjectCannotBeUpdated, CannotManageException, InvalidCollectionModification { // Find requested transition @@ -178,7 +178,7 @@ public class Activity extends WfVertex if (requestData != null && requestData.length()>0) storeOutcome = true; else if (transition.getOutcome().isRequired()) - throw new InvalidData("Transition requires outcome data, but none was given"); + throw new InvalidDataException("Transition requires outcome data, but none was given"); } // Get new state @@ -237,7 +237,7 @@ public class Activity extends WfVertex try { RolePath myRole = Gateway.getLookup().getRolePath(agentRole); pushJobsToAgents(itemPath, myRole); - } catch (ObjectNotFound ex) { // non-existent role + } catch (ObjectNotFoundException ex) { // non-existent role Logger.msg(7, "Activity.pushJobsToAgents() - Activity role '"+agentRole+" not found."); } } @@ -248,13 +248,13 @@ public class Activity extends WfVertex protected String runActivityLogic(AgentPath agent, ItemPath itemPath, int transitionID, String requestData) throws - InvalidData, + InvalidDataException, InvalidCollectionModification, - ObjectAlreadyExists, + ObjectAlreadyExistsException, ObjectCannotBeUpdated, - ObjectNotFound, + ObjectNotFoundException, PersistencyException, - CannotManage + CannotManageException { // Overriden in predefined steps return requestData; @@ -323,14 +323,14 @@ public class Activity extends WfVertex return loop2; } /** sets the next activity available if possible - * @throws ObjectNotFound + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated */ @Override - public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidData + public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidDataException { setActive(false); try @@ -368,7 +368,7 @@ public class Activity extends WfVertex } } } - catch (InvalidData s) + catch (InvalidDataException s) { setActive(true); throw s; @@ -383,10 +383,10 @@ public class Activity extends WfVertex return null; } /** reinitialises the Activity and propagate (for Loop) - * @throws InvalidData - * @throws ObjectNotFound */ + * @throws InvalidDataException + * @throws ObjectNotFoundException */ @Override - public void reinit(int idLoop) throws InvalidData + public void reinit(int idLoop) throws InvalidDataException { Vertex[] outVertices = getOutGraphables(); setState(getStateMachine().getInitialState().getId()); @@ -406,16 +406,16 @@ public class Activity extends WfVertex } /** * called by precedent Activity runNext() for setting the activity able to be executed - * @throws InvalidData - * @throws ObjectAlreadyExists + * @throws InvalidDataException + * @throws ObjectAlreadyExistsException * @throws AccessRightsException - * @throws InvalidTransition - * @throws ObjectNotFound + * @throws InvalidTransitionException + * @throws ObjectNotFoundException * @throws PersistencyException * @throws ObjectCannotBeUpdated */ @Override - public void run(AgentPath agent, ItemPath itemPath) throws InvalidData + public void run(AgentPath agent, ItemPath itemPath) throws InvalidDataException { Logger.debug(8, getPath() + " run " + getState()); @@ -433,16 +433,16 @@ public class Activity extends WfVertex } /** * sets the activity available to be executed on start of Workflow or composite activity (when it is the first one of the (sub)process - * @throws InvalidData - * @throws ObjectAlreadyExists - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectAlreadyExistsException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException * @throws ObjectCannotBeUpdated */ @Override - public void runFirst(AgentPath agent, ItemPath itemPath) throws InvalidData + public void runFirst(AgentPath agent, ItemPath itemPath) throws InvalidDataException { Logger.debug(8, getPath() + " runfirst"); run(agent, itemPath); @@ -475,19 +475,19 @@ public class Activity extends WfVertex /** * returns the lists of jobs for the activity and children (cf com.c2kernel.entity.Job) - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException * @throws InvalidAgentPathException */ - public ArrayList calculateJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFound, InvalidData + public ArrayList calculateJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFoundException, InvalidDataException { return calculateJobsBase(agent, itemPath, false); } // - public ArrayList calculateAllJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFound, InvalidData + public ArrayList calculateAllJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFoundException, InvalidDataException { return calculateJobsBase(agent, itemPath, true); } - private ArrayList calculateJobsBase(AgentPath agent, ItemPath itemPath, boolean includeInactive) throws ObjectNotFound, InvalidData, InvalidAgentPathException + private ArrayList calculateJobsBase(AgentPath agent, ItemPath itemPath, boolean includeInactive) throws ObjectNotFoundException, InvalidDataException, InvalidAgentPathException { Logger.msg(7, "calculateJobs - " + getPath()); ArrayList jobs = new ArrayList(); @@ -510,7 +510,7 @@ public class Activity extends WfVertex try { RolePath myRole = Gateway.getLookup().getRolePath(agentRole); pushJobsToAgents(itemPath, myRole); - } catch (ObjectNotFound ex) { // non-existent role + } catch (ObjectNotFoundException ex) { // non-existent role Logger.msg(7, "Activity.pushJobsToAgents() - Activity role '"+agentRole+" not found."); } } diff --git a/src/main/java/com/c2kernel/lifecycle/instance/AdvancementCalculator.java b/src/main/java/com/c2kernel/lifecycle/instance/AdvancementCalculator.java index 6f5da3a..6f2c9ce 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/AdvancementCalculator.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/AdvancementCalculator.java @@ -22,7 +22,7 @@ package com.c2kernel.lifecycle.instance; import java.util.Hashtable; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.graph.model.Vertex; //import com.c2kernel.utils.Logger; /** @author XSeb74 */ @@ -47,7 +47,7 @@ public class AdvancementCalculator HasNextMarked = new Hashtable(); hasprevActive = new Hashtable(); } - public void calculate(CompositeActivity act) throws InvalidData + public void calculate(CompositeActivity act) throws InvalidDataException { // Logger.debug(0, act.getName()+" >>>>>>>>>"); if (act instanceof Workflow) @@ -77,7 +77,7 @@ public class AdvancementCalculator j++; if (j != 0 && j==nexts.length) current.HasNextMarked.put(v, nexts[0]); } - private void calc(Vertex v, AdvancementCalculator current) throws InvalidData + private void calc(Vertex v, AdvancementCalculator current) throws InvalidDataException { if (current.isMarked.get(v) != null && !(v instanceof Join)) return; diff --git a/src/main/java/com/c2kernel/lifecycle/instance/AndSplit.java b/src/main/java/com/c2kernel/lifecycle/instance/AndSplit.java index c888d7a..5e08e3d 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/AndSplit.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/AndSplit.java @@ -19,7 +19,7 @@ * http://www.fsf.org/licensing/licenses/lgpl.html */ package com.c2kernel.lifecycle.instance; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.graph.model.Vertex; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -37,7 +37,7 @@ public class AndSplit extends Split super(); } @Override - public void runNext(AgentPath agent, ItemPath item) throws InvalidData + public void runNext(AgentPath agent, ItemPath item) throws InvalidDataException { AdvancementCalculator adv = new AdvancementCalculator(); adv.calculate((CompositeActivity) getParent()); diff --git a/src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java b/src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java index 8e08f99..9bb5c84 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java @@ -23,13 +23,13 @@ package com.c2kernel.lifecycle.instance; import java.util.ArrayList; import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.CannotManage; +import com.c2kernel.common.CannotManageException; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +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.agent.Job; import com.c2kernel.graph.model.GraphModel; @@ -306,17 +306,17 @@ public class CompositeActivity extends Activity } /** - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated * @see com.c2kernel.lifecycle.instance.WfVertex#run() */ @Override - public void run(AgentPath agent, ItemPath itemPath) throws InvalidData + public void run(AgentPath agent, ItemPath itemPath) throws InvalidDataException { super.run(agent, itemPath); if (getChildrenGraphModel().getStartVertex() != null && !getStateMachine().getState(state).isFinished()) @@ -327,7 +327,7 @@ public class CompositeActivity extends Activity } @Override - public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidData + public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidDataException { if (!getStateMachine().getState(state).isFinished()) try { @@ -342,13 +342,13 @@ public class CompositeActivity extends Activity /** - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException * @throws InvalidAgentPathException * @see com.c2kernel.lifecycle.instance.Activity#calculateJobs() */ @Override - public ArrayList calculateJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFound, InvalidData + public ArrayList calculateJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFoundException, InvalidDataException { ArrayList jobs = new ArrayList(); boolean childActive = false; @@ -366,7 +366,7 @@ public class CompositeActivity extends Activity } @Override - public ArrayList calculateAllJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFound, InvalidData + public ArrayList calculateAllJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFoundException, InvalidDataException { ArrayList jobs = new ArrayList(); if (recurse) @@ -436,11 +436,11 @@ public class CompositeActivity extends Activity } /** - * @throws InvalidData + * @throws InvalidDataException * */ @Override - public void reinit(int idLoop) throws InvalidData + public void reinit(int idLoop) throws InvalidDataException { super.reinit(idLoop); if (getChildrenGraphModel().getStartVertex() != null && !getStateMachine().getState(state).isFinished()) @@ -448,7 +448,7 @@ public class CompositeActivity extends Activity } @Override - public String request(AgentPath agent, ItemPath itemPath, int transitionID, String requestData) throws AccessRightsException, InvalidTransition, InvalidData, ObjectNotFound, PersistencyException, ObjectAlreadyExists, ObjectCannotBeUpdated, CannotManage, InvalidCollectionModification + public String request(AgentPath agent, ItemPath itemPath, int transitionID, String requestData) throws AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectNotFoundException, PersistencyException, ObjectAlreadyExistsException, ObjectCannotBeUpdated, CannotManageException, InvalidCollectionModification { if (getChildrenGraphModel().getStartVertex() != null && !getStateMachine().getState(state).isFinished() && transitionID == CompositeActivity.START) ((WfVertex) getChildrenGraphModel().getStartVertex()).run(agent, itemPath); diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Join.java b/src/main/java/com/c2kernel/lifecycle/instance/Join.java index 2482f49..1a415d7 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Join.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Join.java @@ -22,11 +22,11 @@ package com.c2kernel.lifecycle.instance; import java.util.Vector; import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +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.graph.model.Vertex; import com.c2kernel.graph.traversal.GraphTraversal; @@ -51,17 +51,17 @@ public class Join extends WfVertex public int counter = 0; /** - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated * @see com.c2kernel.lifecycle.instance.WfVertex#runNext() */ @Override - public void runNext(AgentPath agent, ItemPath item) throws InvalidData + public void runNext(AgentPath agent, ItemPath item) throws InvalidDataException { AdvancementCalculator adv = new AdvancementCalculator(); adv.calculate((CompositeActivity) getParent()); @@ -87,11 +87,11 @@ public class Join extends WfVertex new Next(this, (WfVertex) getParent().search(idNext)); } /** - * @throws InvalidData + * @throws InvalidDataException * @see com.c2kernel.lifecycle.instance.WfVertex#reinit(int) */ @Override - public void reinit(int idLoop) throws InvalidData + public void reinit(int idLoop) throws InvalidDataException { Vertex[] outVertices = getOutGraphables(); if (outVertices.length == 1) @@ -174,17 +174,17 @@ public class Join extends WfVertex return mErrors.elementAt(0); } /** - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated * @see com.c2kernel.lifecycle.instance.WfVertex#run() */ @Override - public void run(AgentPath agent, ItemPath item) throws InvalidData + public void run(AgentPath agent, ItemPath item) throws InvalidDataException { runNext(agent, item); } @@ -215,7 +215,7 @@ public class Join extends WfVertex return loop2; } @Override - public void runFirst(AgentPath agent, ItemPath item) throws InvalidData + public void runFirst(AgentPath agent, ItemPath item) throws InvalidDataException { runNext(agent, item); } diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Loop.java b/src/main/java/com/c2kernel/lifecycle/instance/Loop.java index 30e1bb7..1553fdf 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Loop.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Loop.java @@ -19,7 +19,7 @@ * http://www.fsf.org/licensing/licenses/lgpl.html */ package com.c2kernel.lifecycle.instance; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.graph.model.Vertex; import com.c2kernel.graph.traversal.GraphTraversal; import com.c2kernel.lookup.AgentPath; @@ -47,7 +47,7 @@ public class Loop extends XOrSplit return true; } @Override - public void followNext(Next activeNext, AgentPath agent, ItemPath itemPath) throws InvalidData + public void followNext(Next activeNext, AgentPath agent, ItemPath itemPath) throws InvalidDataException { WfVertex v = activeNext.getTerminusVertex(); if (!isInPrev(v)) @@ -59,11 +59,11 @@ public class Loop extends XOrSplit } } /** - * @throws InvalidData + * @throws InvalidDataException * @see com.c2kernel.lifecycle.instance.WfVertex#reinit(int) */ @Override - public void reinit(int idLoop) throws InvalidData + public void reinit(int idLoop) throws InvalidDataException { Logger.msg(8, "Loop.reinit"); if (idLoop == getID()) diff --git a/src/main/java/com/c2kernel/lifecycle/instance/OrSplit.java b/src/main/java/com/c2kernel/lifecycle/instance/OrSplit.java index eabf46a..349000d 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/OrSplit.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/OrSplit.java @@ -21,7 +21,7 @@ package com.c2kernel.lifecycle.instance; import java.util.StringTokenizer; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.graph.model.DirectedEdge; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -41,7 +41,7 @@ public class OrSplit extends Split super(); } @Override - public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidData + public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidDataException { String nexts; String scriptName = (String) getProperties().get("RoutingScriptName"); @@ -50,7 +50,7 @@ public class OrSplit extends Split nexts = this.evaluateScript(scriptName, scriptVersion, itemPath).toString(); } catch (ScriptingEngineException e) { Logger.error(e); - throw new InvalidData("Error running routing script "+scriptName+" v"+scriptVersion); + throw new InvalidDataException("Error running routing script "+scriptName+" v"+scriptVersion); } StringTokenizer tok = new StringTokenizer(nexts, ","); Logger.msg(7, tok.countTokens() + " nexts to activate:" + nexts); @@ -82,7 +82,7 @@ public class OrSplit extends Split Logger.error(e); } if (active == 0) - throw new InvalidData("No nexts were activated!"); + throw new InvalidDataException("No nexts were activated!"); } diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Split.java b/src/main/java/com/c2kernel/lifecycle/instance/Split.java index e4bbb09..d4fb0fd 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Split.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Split.java @@ -23,11 +23,11 @@ package com.c2kernel.lifecycle.instance; import java.util.Vector; import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +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.graph.model.Vertex; import com.c2kernel.graph.traversal.GraphTraversal; @@ -55,17 +55,17 @@ public abstract class Split extends WfVertex private boolean loopTested; /** - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated * @see com.c2kernel.lifecycle.instance.WfVertex#runNext() */ @Override - public abstract void runNext(AgentPath agent, ItemPath itemPath) throws InvalidData; + public abstract void runNext(AgentPath agent, ItemPath itemPath) throws InvalidDataException; /** * Method addNext. @@ -97,7 +97,7 @@ public abstract class Split extends WfVertex } @Override - public void reinit(int idLoop) throws InvalidData + public void reinit(int idLoop) throws InvalidDataException { Vertex[] outVertices = getOutGraphables(); for (Vertex outVertice : outVertices) @@ -171,17 +171,17 @@ public abstract class Split extends WfVertex } /** - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated * @see com.c2kernel.lifecycle.instance.WfVertex#run() */ @Override - public void run(AgentPath agent, ItemPath itemPath) throws InvalidData + public void run(AgentPath agent, ItemPath itemPath) throws InvalidDataException { runNext(agent, itemPath); } @@ -230,7 +230,7 @@ public abstract class Split extends WfVertex } @Override - public void runFirst(AgentPath agent, ItemPath itemPath) throws InvalidData + public void runFirst(AgentPath agent, ItemPath itemPath) throws InvalidDataException { runNext(agent, itemPath); } diff --git a/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java b/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java index 7eb61a6..9bf0fd4 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java @@ -25,11 +25,11 @@ package com.c2kernel.lifecycle.instance; import java.util.HashMap; import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +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.graph.model.GraphableVertex; import com.c2kernel.lifecycle.routingHelpers.ViewpointDataHelper; @@ -50,14 +50,14 @@ public abstract class WfVertex extends GraphableVertex { /**sets the activity available to be executed on start of Workflow or composite activity (when it is the first one of the * (sub)process - * @throws InvalidData - * @throws ObjectAlreadyExists - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectAlreadyExistsException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException * @throws ObjectCannotBeUpdated */ - public abstract void runFirst(AgentPath agent, ItemPath itemPath) throws InvalidData; + public abstract void runFirst(AgentPath agent, ItemPath itemPath) throws InvalidDataException; /** * @see java.lang.Object#Object() @@ -71,15 +71,15 @@ public abstract class WfVertex extends GraphableVertex /** * Method runNext. - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated */ - public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidData + public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidDataException { try { @@ -95,10 +95,10 @@ public abstract class WfVertex extends GraphableVertex /** * Method reinit. * @param idLoop - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException */ - public abstract void reinit( int idLoop ) throws InvalidData; + public abstract void reinit( int idLoop ) throws InvalidDataException; /** * Method verify. @@ -114,15 +114,15 @@ public abstract class WfVertex extends GraphableVertex /** * Method run. - * @throws InvalidData - * @throws ObjectAlreadyExists - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectAlreadyExistsException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException * @throws ObjectCannotBeUpdated */ - public abstract void run(AgentPath agent, ItemPath itemPath) throws InvalidData; + public abstract void run(AgentPath agent, ItemPath itemPath) throws InvalidDataException; /** * Method loop. @@ -159,7 +159,7 @@ public abstract class WfVertex extends GraphableVertex try { inputParam = ViewpointDataHelper.get(value)[0]; } catch (ArrayIndexOutOfBoundsException ex) { - throw new InvalidData("Could not retrieve data from viewpoint: "+value); + throw new InvalidDataException("Could not retrieve data from viewpoint: "+value); } } if (value.startsWith("property//")) @@ -167,7 +167,7 @@ public abstract class WfVertex extends GraphableVertex value = value.substring(10); try { inputParam = Gateway.getStorage().get(itemPath, ClusterStorage.PROPERTY+"/"+value, null); - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { inputParam = null; } } diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java b/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java index f1719f6..f152adc 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java @@ -22,13 +22,13 @@ package com.c2kernel.lifecycle.instance; import java.util.ArrayList; import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.CannotManage; +import com.c2kernel.common.CannotManageException; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +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.C2KLocalObject; import com.c2kernel.entity.agent.Job; @@ -81,10 +81,10 @@ public class Workflow extends CompositeActivity implements C2KLocalObject addChild(predef, new GraphPoint(300, 100)); } - public History getHistory() throws InvalidData { + public History getHistory() throws InvalidDataException { if (history == null) { if (itemPath == null) - throw new InvalidData("Workflow not initialized."); + throw new InvalidDataException("Workflow not initialized."); history = new History(itemPath, this); } return history; @@ -117,24 +117,24 @@ public class Workflow extends CompositeActivity implements C2KLocalObject * @param stepPath * @param transitionID * @param reguestData - * @throws ObjectNotFound + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition - * @throws InvalidData + * @throws InvalidTransitionException + * @throws InvalidDataException * @throws PersistencyException * @throws ObjectCannotBeUpdated - * @throws CannotManage + * @throws CannotManageException * @throws InvalidCollectionModification */ //requestData is xmlstring public String requestAction(AgentPath agent, String stepPath, ItemPath itemPath, int transitionID, String requestData) - throws ObjectNotFound, AccessRightsException, InvalidTransition, InvalidData, ObjectAlreadyExists, PersistencyException, ObjectCannotBeUpdated, CannotManage, InvalidCollectionModification + throws ObjectNotFoundException, AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectAlreadyExistsException, PersistencyException, ObjectCannotBeUpdated, CannotManageException, InvalidCollectionModification { Logger.msg(3, "Action: " + transitionID + " " + stepPath + " by " + agent); if (search(stepPath) != null) return ((Activity) search(stepPath)).request(agent, itemPath, transitionID, requestData); else - throw new ObjectNotFound(stepPath + " not found"); + throw new ObjectNotFoundException(stepPath + " not found"); } /** @@ -196,14 +196,14 @@ public class Workflow extends CompositeActivity implements C2KLocalObject * Method initialise. * * @param systemKey - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition - * @throws ObjectAlreadyExists + * @throws InvalidTransitionException + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated */ - public void initialise(ItemPath itemPath, AgentPath agent) throws InvalidData + public void initialise(ItemPath itemPath, AgentPath agent) throws InvalidDataException { setItemPath(itemPath); runFirst(agent, itemPath); @@ -232,11 +232,11 @@ public class Workflow extends CompositeActivity implements C2KLocalObject * @param itemSysKey * @param type * @return - * @throws ObjectNotFound - * @throws InvalidData + * @throws ObjectNotFoundException + * @throws InvalidDataException * @throws InvalidAgentPathException */ - public ArrayList calculateJobs(AgentPath agent, ItemPath itemPath, int type) throws InvalidAgentPathException, ObjectNotFound, InvalidData + public ArrayList calculateJobs(AgentPath agent, ItemPath itemPath, int type) throws InvalidAgentPathException, ObjectNotFoundException, InvalidDataException { ArrayList jobs = new ArrayList(); if (type != 1) diff --git a/src/main/java/com/c2kernel/lifecycle/instance/XOrSplit.java b/src/main/java/com/c2kernel/lifecycle/instance/XOrSplit.java index e5b91d3..7b47fd5 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/XOrSplit.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/XOrSplit.java @@ -23,7 +23,7 @@ package com.c2kernel.lifecycle.instance; import java.util.ArrayList; import java.util.StringTokenizer; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.graph.model.DirectedEdge; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -45,7 +45,7 @@ public class XOrSplit extends Split } @Override - public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidData + public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidDataException { ArrayList nextsToFollow = new ArrayList(); String nexts; @@ -55,7 +55,7 @@ public class XOrSplit extends Split nexts = this.evaluateScript(scriptName, scriptVersion, itemPath).toString(); } catch (ScriptingEngineException e) { Logger.error(e); - throw new InvalidData("Error running routing script "+scriptName+" v"+scriptVersion); + throw new InvalidDataException("Error running routing script "+scriptName+" v"+scriptVersion); } StringTokenizer tok = new StringTokenizer(nexts,","); @@ -70,13 +70,13 @@ public class XOrSplit extends Split } // Logger.debug(0, getID()+" following "+nexts); if (nextsToFollow.size() != 1) - throw new InvalidData("not good number of active next"); + throw new InvalidDataException("not good number of active next"); followNext((Next)nextsToFollow.get(0), agent, itemPath); } - public void followNext(Next activeNext, AgentPath agent, ItemPath itemPath) throws InvalidData { + public void followNext(Next activeNext, AgentPath agent, ItemPath itemPath) throws InvalidDataException { activeNext.getTerminusVertex().run(agent, itemPath); } diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddC2KObject.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddC2KObject.java index 8c078aa..a39e815 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddC2KObject.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddC2KObject.java @@ -22,7 +22,7 @@ package com.c2kernel.lifecycle.instance.predefined; import java.util.Arrays; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.lookup.AgentPath; @@ -49,16 +49,16 @@ public class AddC2KObject extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, PersistencyException { String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "AddC2KObject: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); - if (params.length != 1) throw new InvalidData("AddC2KObject: Invalid parameters "+Arrays.toString(params)); + if (params.length != 1) throw new InvalidDataException("AddC2KObject: Invalid parameters "+Arrays.toString(params)); C2KLocalObject obj; try { obj = (C2KLocalObject)Gateway.getMarshaller().unmarshall(params[0]); } catch (Exception e) { - throw new InvalidData("AddC2KObject: Could not unmarshall new object: "+params[0]); + throw new InvalidDataException("AddC2KObject: Could not unmarshall new object: "+params[0]); } Gateway.getStorage().put(item, obj, null ); return requestData; diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java index 1067911..8723d3b 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java @@ -25,9 +25,9 @@ package com.c2kernel.lifecycle.instance.predefined; 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.lookup.AgentPath; import com.c2kernel.lookup.DomainPath; @@ -46,11 +46,11 @@ public class AddDomainPath extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectCannotBeUpdated, ObjectAlreadyExists, CannotManage { + int transitionID, String requestData) throws InvalidDataException, ObjectCannotBeUpdated, ObjectAlreadyExistsException, CannotManageException { String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "AddDomainPath: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); - if (params.length != 1) throw new InvalidData("AddDomainPath: Invalid parameters "+Arrays.toString(params)); + if (params.length != 1) throw new InvalidDataException("AddDomainPath: Invalid parameters "+Arrays.toString(params)); LookupManager lookupManager = Gateway.getLookupManager(); diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddMemberToCollection.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddMemberToCollection.java index 43316b2..90db8e1 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddMemberToCollection.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddMemberToCollection.java @@ -25,9 +25,9 @@ import java.util.Arrays; import com.c2kernel.collection.Dependency; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectAlreadyExists; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectAlreadyExistsException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.lookup.AgentPath; @@ -59,14 +59,14 @@ public class AddMemberToCollection extends PredefinedStep * Params: * 0 - collection name * 1 - target entity key - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws PersistencyException - * @throws ObjectNotFound + * @throws ObjectNotFoundException * @throws InvalidCollectionModification */ @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectAlreadyExists, PersistencyException, ObjectNotFound, InvalidCollectionModification { + int transitionID, String requestData) throws InvalidDataException, ObjectAlreadyExistsException, PersistencyException, ObjectNotFoundException, InvalidCollectionModification { String collName; ItemPath newChild; @@ -83,13 +83,13 @@ public class AddMemberToCollection extends PredefinedStep props = (CastorHashMap)Gateway.getMarshaller().unmarshall(params[2]); } catch (Exception e) { - throw new InvalidData("AddMemberToCollection: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("AddMemberToCollection: Invalid parameters "+Arrays.toString(params)); } // load collection C2KLocalObject collObj; collObj = Gateway.getStorage().get(item, ClusterStorage.COLLECTION+"/"+collName+"/last", null); - if (!(collObj instanceof Dependency)) throw new InvalidData("AddMemberToCollection: AddMemberToCollection operates on Dependency collections only."); + if (!(collObj instanceof Dependency)) throw new InvalidDataException("AddMemberToCollection: AddMemberToCollection operates on Dependency collections only."); dep = (Dependency)collObj; // find member and assign entity diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddNewCollectionDescription.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddNewCollectionDescription.java index 6eb69f3..99fd666 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddNewCollectionDescription.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddNewCollectionDescription.java @@ -26,9 +26,9 @@ import java.util.Arrays; import com.c2kernel.collection.AggregationDescription; import com.c2kernel.collection.CollectionDescription; import com.c2kernel.collection.DependencyDescription; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectAlreadyExists; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectAlreadyExistsException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -63,7 +63,7 @@ public class AddNewCollectionDescription extends PredefinedStep */ @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectAlreadyExists, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, ObjectAlreadyExistsException, PersistencyException { String collName; String collType; @@ -72,7 +72,7 @@ public class AddNewCollectionDescription extends PredefinedStep String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "AddNewCollectionDescription: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); if (params.length != 2) - throw new InvalidData("AddNewCollectionDescription: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("AddNewCollectionDescription: Invalid parameters "+Arrays.toString(params)); collName = params[0]; collType = params[1]; @@ -80,8 +80,8 @@ public class AddNewCollectionDescription extends PredefinedStep // check if collection already exists try { Gateway.getStorage().get(item, ClusterStorage.COLLECTION+"/"+collName+"/last", null); - throw new ObjectAlreadyExists("Collection '"+collName+"' already exists"); - } catch (ObjectNotFound ex) { + throw new ObjectAlreadyExistsException("Collection '"+collName+"' already exists"); + } catch (ObjectNotFoundException ex) { // collection doesn't exist } catch (PersistencyException ex) { Logger.error(ex); @@ -96,7 +96,7 @@ public class AddNewCollectionDescription extends PredefinedStep if (collType.equals("Dependency")) newCollDesc = new DependencyDescription(collName); else - throw new InvalidData("AddNewCollectionDescription: Invalid collection type specified: '"+collType+"'. Must be Aggregation or Dependency."); + throw new InvalidDataException("AddNewCollectionDescription: Invalid collection type specified: '"+collType+"'. Must be Aggregation or Dependency."); // store it try { diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddNewSlot.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddNewSlot.java index 19ef2ae..3d9e5d3 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddNewSlot.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddNewSlot.java @@ -24,8 +24,8 @@ package com.c2kernel.lifecycle.instance.predefined; import java.util.Arrays; import com.c2kernel.collection.Aggregation; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.lookup.AgentPath; @@ -63,13 +63,13 @@ public class AddNewSlot extends PredefinedStep *
  • Item Description version (optional)
  • * * - * @throws InvalidData Then the parameters were incorrect + * @throws InvalidDataException Then the parameters were incorrect * @throws PersistencyException There was a problem loading or saving the collection from persistency - * @throws ObjectNotFound A required object, such as the collection or a PropertyDescription outcome, wasn't found + * @throws ObjectNotFoundException A required object, such as the collection or a PropertyDescription outcome, wasn't found */ @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, PersistencyException, ObjectNotFound { + int transitionID, String requestData) throws InvalidDataException, PersistencyException, ObjectNotFoundException { String collName; ItemPath descKey = null; @@ -86,7 +86,7 @@ public class AddNewSlot extends PredefinedStep if (params.length > 1 && params[1].length() > 0) descKey = new ItemPath(params[1]); if (params.length > 2 && params[2].length() > 0) descVer = params[2]; } catch (Exception e) { - throw new InvalidData("AddNewSlot: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("AddNewSlot: Invalid parameters "+Arrays.toString(params)); } // load collection @@ -97,7 +97,7 @@ public class AddNewSlot extends PredefinedStep Logger.error(ex); throw new PersistencyException("AddNewSlot: Error loading collection '\"+collName+\"': "+ex.getMessage()); } - if (!(collObj instanceof Aggregation)) throw new InvalidData("AddNewSlot: AddNewSlot operates on Aggregation collections only."); + if (!(collObj instanceof Aggregation)) throw new InvalidDataException("AddNewSlot: AddNewSlot operates on Aggregation collections only."); agg = (Aggregation)collObj; // get props diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java index fdf852f..04d6770 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java @@ -26,9 +26,9 @@ import java.util.Arrays; import com.c2kernel.collection.Aggregation; import com.c2kernel.collection.AggregationMember; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidData; +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.entity.C2KLocalObject; import com.c2kernel.lookup.AgentPath; @@ -58,14 +58,14 @@ public class AssignItemToSlot extends PredefinedStep * 0 - collection name * 1 - slot number * 2 - target entity key - * @throws ObjectNotFound + * @throws ObjectNotFoundException * @throws PersistencyException * @throws ObjectCannotBeUpdated * @throws InvalidCollectionModification */ @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectNotFound, PersistencyException, ObjectCannotBeUpdated, InvalidCollectionModification { + int transitionID, String requestData) throws InvalidDataException, ObjectNotFoundException, PersistencyException, ObjectCannotBeUpdated, InvalidCollectionModification { String collName; int slotNo; @@ -81,7 +81,7 @@ public class AssignItemToSlot extends PredefinedStep slotNo = Integer.parseInt(params[1]); childItem = new ItemPath(params[2]); } catch (Exception e) { - throw new InvalidData("AssignItemToSlot: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("AssignItemToSlot: Invalid parameters "+Arrays.toString(params)); } // load collection @@ -92,7 +92,7 @@ public class AssignItemToSlot extends PredefinedStep Logger.error(ex); throw new PersistencyException("AssignItemToSlot: Error loading collection '\"+collName+\"': "+ex.getMessage()); } - if (!(collObj instanceof Aggregation)) throw new InvalidData("AssignItemToSlot: AssignItemToSlot operates on Aggregation collections only."); + if (!(collObj instanceof Aggregation)) throw new InvalidDataException("AssignItemToSlot: AssignItemToSlot operates on Aggregation collections only."); agg = (Aggregation)collObj; // find member and assign entity @@ -107,7 +107,7 @@ public class AssignItemToSlot extends PredefinedStep } } if (!stored) { - throw new ObjectNotFound("AssignItemToSlot: Member slot "+slotNo+" not found."); + throw new ObjectNotFoundException("AssignItemToSlot: Member slot "+slotNo+" not found."); } try { diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/ClearSlot.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/ClearSlot.java index a15b98f..1bfb8d0 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/ClearSlot.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/ClearSlot.java @@ -25,9 +25,9 @@ import java.util.Arrays; import com.c2kernel.collection.Aggregation; import com.c2kernel.collection.AggregationMember; -import com.c2kernel.common.InvalidData; +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.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -55,13 +55,13 @@ public class ClearSlot extends PredefinedStep * Params: * 0 - collection name * 1 - slot number - * @throws ObjectNotFound + * @throws ObjectNotFoundException * @throws PersistencyException * @throws ObjectCannotBeUpdated */ @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectNotFound, PersistencyException, ObjectCannotBeUpdated { + int transitionID, String requestData) throws InvalidDataException, ObjectNotFoundException, PersistencyException, ObjectCannotBeUpdated { String collName; int slotNo; @@ -75,7 +75,7 @@ public class ClearSlot extends PredefinedStep collName = params[0]; slotNo = Integer.parseInt(params[1]); } catch (Exception e) { - throw new InvalidData("ClearSlot: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("ClearSlot: Invalid parameters "+Arrays.toString(params)); } // load collection @@ -98,7 +98,7 @@ public class ClearSlot extends PredefinedStep } } if (!stored) { - throw new ObjectNotFound("ClearSlot: Member slot "+slotNo+" not found."); + throw new ObjectNotFoundException("ClearSlot: Member slot "+slotNo+" not found."); } diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/Import.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/Import.java index e17919d..12cb488 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/Import.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/Import.java @@ -22,7 +22,7 @@ package com.c2kernel.lifecycle.instance.predefined; import java.util.Arrays; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.PersistencyException; import com.c2kernel.events.Event; import com.c2kernel.events.History; @@ -54,7 +54,7 @@ public class Import extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, PersistencyException { String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "Import: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); @@ -63,7 +63,7 @@ public class Import extends PredefinedStep int split2 = params[0].indexOf(':'); if (split1 == -1) - throw new InvalidData("Import: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("Import: Invalid parameters "+Arrays.toString(params)); requestData = params[1]; diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveC2KObject.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveC2KObject.java index a88e000..ef7d16b 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveC2KObject.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveC2KObject.java @@ -24,7 +24,7 @@ package com.c2kernel.lifecycle.instance.predefined; import java.util.Arrays; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.PersistencyException; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -48,12 +48,12 @@ public class RemoveC2KObject extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, PersistencyException { String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "RemoveC2KObject: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); if (params.length != 1) - throw new InvalidData("RemoveC2KObject: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("RemoveC2KObject: Invalid parameters "+Arrays.toString(params)); String path = params[0]; try diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java index 0248650..3308003 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java @@ -25,10 +25,10 @@ package com.c2kernel.lifecycle.instance.predefined; 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.lookup.AgentPath; import com.c2kernel.lookup.DomainPath; import com.c2kernel.lookup.ItemPath; @@ -46,23 +46,23 @@ public class RemoveDomainPath extends PredefinedStep //requestdata is xmlstring @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, "RemoveDomainPath: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); - if (params.length != 1) throw new InvalidData("RemoveDomainPath: Invalid parameters "+Arrays.toString(params)); + if (params.length != 1) throw new InvalidDataException("RemoveDomainPath: Invalid parameters "+Arrays.toString(params)); DomainPath domainPath = new DomainPath(params[0]); if (!domainPath.exists()) - throw new ObjectNotFound("RemoveDomainPath: Domain path "+domainPath.toString()+" does not exist."); + throw new ObjectNotFoundException("RemoveDomainPath: Domain path "+domainPath.toString()+" does not exist."); if (domainPath.getType()!=DomainPath.ENTITY) try { if (!domainPath.getItemPath().equals(item)) - throw new InvalidData("RemoveDomainPath: Domain path "+domainPath.toString()+" is not an alias of the current Item "+item); - } catch (ObjectNotFound ex) { - throw new InvalidData("RemoveDomainPath: Domain path "+domainPath.toString()+" is a context."); + throw new InvalidDataException("RemoveDomainPath: Domain path "+domainPath.toString()+" is not an alias of the current Item "+item); + } catch (ObjectNotFoundException ex) { + throw new InvalidDataException("RemoveDomainPath: Domain path "+domainPath.toString()+" is a context."); } LookupManager lookupManager = Gateway.getLookupManager(); diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveSlotFromCollection.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveSlotFromCollection.java index 061202d..7bd921b 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveSlotFromCollection.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveSlotFromCollection.java @@ -25,8 +25,8 @@ import java.util.Arrays; import com.c2kernel.collection.Collection; import com.c2kernel.collection.CollectionMember; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -55,12 +55,12 @@ public class RemoveSlotFromCollection extends PredefinedStep * 0 - collection name * 1 - slot number OR if null: * 2 - target entity key - * @throws ObjectNotFound + * @throws ObjectNotFoundException * @throws PersistencyException */ @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectNotFound, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, ObjectNotFoundException, PersistencyException { String collName; int slotNo = -1; @@ -76,11 +76,11 @@ public class RemoveSlotFromCollection extends PredefinedStep if (params.length>1 && params[1].length()>0) slotNo = Integer.parseInt(params[1]); if (params.length>2 && params[2].length()>0) currentChild = new ItemPath(params[2]); } catch (Exception e) { - throw new InvalidData("RemoveSlotFromCollection: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("RemoveSlotFromCollection: Invalid parameters "+Arrays.toString(params)); } if (slotNo == -1 && currentChild == null) - throw new InvalidData("RemoveSlotFromCollection: Must give either slot number or entity key"); + throw new InvalidDataException("RemoveSlotFromCollection: Must give either slot number or entity key"); // load collection try { @@ -98,7 +98,7 @@ public class RemoveSlotFromCollection extends PredefinedStep // if both parameters are supplied, check the given item is actually in that slot if (slot != null && currentChild != null && !slot.getItemPath().equals(currentChild)) { - throw new ObjectNotFound("RemoveSlotFromCollection: Item "+currentChild+" was not in slot "+slotNo); + throw new ObjectNotFoundException("RemoveSlotFromCollection: Item "+currentChild+" was not in slot "+slotNo); } if (slotNo == -1) { // find slot from entity key @@ -110,7 +110,7 @@ public class RemoveSlotFromCollection extends PredefinedStep } } if (slotNo == -1) { - throw new ObjectNotFound("Could not find "+currentChild+" in collection "+coll.getName()); + throw new ObjectNotFoundException("Could not find "+currentChild+" in collection "+coll.getName()); } // Remove the slot diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java index ddb89ba..f2d34c4 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java @@ -23,7 +23,7 @@ package com.c2kernel.lifecycle.instance.predefined; //Java import java.util.Arrays; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.PersistencyException; import com.c2kernel.graph.model.GraphPoint; import com.c2kernel.lifecycle.instance.CompositeActivity; @@ -43,13 +43,13 @@ public class ReplaceDomainWorkflow extends PredefinedStep @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, PersistencyException { Workflow lifeCycle = getWf(); String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "AddC2KObject: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); - if (params.length != 1) throw new InvalidData("AddC2KObject: Invalid parameters "+Arrays.toString(params)); + if (params.length != 1) throw new InvalidDataException("AddC2KObject: Invalid parameters "+Arrays.toString(params)); lifeCycle.getChildGraphModel().removeVertex(lifeCycle.search("workflow/domain")); CompositeActivity domain; @@ -57,7 +57,7 @@ public class ReplaceDomainWorkflow extends PredefinedStep domain = (CompositeActivity) Gateway.getMarshaller().unmarshall(params[0]); } catch (Exception e) { Logger.error(e); - throw new InvalidData("ReplaceDomainWorkflow: Could not unmarshall new workflow: "+e.getMessage()); + throw new InvalidDataException("ReplaceDomainWorkflow: Could not unmarshall new workflow: "+e.getMessage()); } domain.setName("domain"); lifeCycle.initChild(domain, true, new GraphPoint(150, 100)); diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java index e41411b..2813f43 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java @@ -22,9 +22,9 @@ package com.c2kernel.lifecycle.instance.predefined; import java.util.Arrays; -import com.c2kernel.common.InvalidData; +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.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -51,13 +51,13 @@ public class WriteProperty extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectCannotBeUpdated, ObjectNotFound, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, ObjectCannotBeUpdated, ObjectNotFoundException, PersistencyException { String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "WriteProperty: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); if (params.length != 2) - throw new InvalidData("WriteProperty: invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("WriteProperty: invalid parameters "+Arrays.toString(params)); String name = params[0]; String newValue = params[1]; @@ -70,8 +70,8 @@ public class WriteProperty extends PredefinedStep throw new ObjectCannotBeUpdated("WriteProperty: Property '"+name+"' is not mutable."); prop.setValue(newValue); Gateway.getStorage().put(item, prop, null); - } catch (ObjectNotFound e) { - throw new ObjectNotFound("WriteProperty: Property '"+name+"' not found."); + } catch (ObjectNotFoundException e) { + throw new ObjectNotFoundException("WriteProperty: Property '"+name+"' not found."); } return requestData; diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/WriteViewpoint.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/WriteViewpoint.java index efe6a5f..a8a17ce 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/WriteViewpoint.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/WriteViewpoint.java @@ -22,8 +22,8 @@ package com.c2kernel.lifecycle.instance.predefined; import java.util.Arrays; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.events.Event; import com.c2kernel.lookup.AgentPath; @@ -41,7 +41,7 @@ public class WriteViewpoint extends PredefinedStep { @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectNotFound, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, ObjectNotFoundException, PersistencyException { String schemaName; String viewName; @@ -52,7 +52,7 @@ public class WriteViewpoint extends PredefinedStep { // outcometype, name and evId. Event and Outcome should be checked so schema version should be discovered. if (params.length != 3) - throw new InvalidData("WriteViewpoint: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("WriteViewpoint: Invalid parameters "+Arrays.toString(params)); schemaName = params[0]; viewName = params[1]; @@ -60,7 +60,7 @@ public class WriteViewpoint extends PredefinedStep { try { evId = Integer.parseInt(params[2]); } catch (NumberFormatException ex) { - throw new InvalidData("WriteViewpoint: Parameter 3 (EventId) must be an integer"); + throw new InvalidDataException("WriteViewpoint: Parameter 3 (EventId) must be an integer"); } // Find event 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 *
  • Comma-delimited Role names to assign to the agent. Must already exist.
  • *
  • Initial properties to set in the new Agent
  • * - * @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 rolesToRemove = new ArrayList(); @@ -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; diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/CreateItemFromDescription.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/CreateItemFromDescription.java index 02ea642..140f68c 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/CreateItemFromDescription.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/CreateItemFromDescription.java @@ -24,11 +24,11 @@ import com.c2kernel.collection.Collection; import com.c2kernel.collection.CollectionArrayList; import com.c2kernel.collection.CollectionDescription; import com.c2kernel.collection.CollectionMember; -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.TraceableEntity; @@ -62,7 +62,7 @@ public class CreateItemFromDescription extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath itemPath, - int transitionID, String requestData) throws InvalidData, ObjectNotFound, ObjectAlreadyExists, CannotManage, ObjectCannotBeUpdated, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, ObjectNotFoundException, ObjectAlreadyExistsException, CannotManageException, ObjectCannotBeUpdated, PersistencyException { String[] input = getDataList(requestData); String newName = input[0]; @@ -77,7 +77,7 @@ public class CreateItemFromDescription extends PredefinedStep DomainPath context = new DomainPath(new DomainPath(domPath), newName); //Logger.debug(8,"context "+context.getItemPath()+" "+context.getPath()+" "+context.getString()); if (context.exists()) - throw new ObjectAlreadyExists("The path " +context+ " exists already."); + throw new ObjectAlreadyExistsException("The path " +context+ " exists already."); // get init objects @@ -93,7 +93,7 @@ public class CreateItemFromDescription extends PredefinedStep // 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"); TraceableEntity newItem = factory.createItem(newItemPath); Gateway.getLookupManager().add(newItemPath); @@ -112,7 +112,7 @@ public class CreateItemFromDescription extends PredefinedStep } catch (PersistencyException e) { throw e; } 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 its domain path Logger.msg(3, "CreateItemFromDescription - Creating "+context); @@ -121,16 +121,16 @@ public class CreateItemFromDescription extends PredefinedStep return requestData; } - protected PropertyArrayList getInitProperties(String input) throws InvalidData { + protected PropertyArrayList getInitProperties(String input) throws InvalidDataException { try { return (PropertyArrayList)Gateway.getMarshaller().unmarshall(input); } catch (Exception e) { Logger.error(e); - throw new InvalidData("Initial property parameter was not a marshalled PropertyArrayList: "+input); + throw new InvalidDataException("Initial property parameter was not a marshalled PropertyArrayList: "+input); } } - protected PropertyArrayList getNewProperties(ItemPath itemPath, String descVer, PropertyArrayList initProps, String newName, AgentPath agent) throws ObjectNotFound, InvalidData { + protected PropertyArrayList getNewProperties(ItemPath itemPath, String descVer, PropertyArrayList initProps, String newName, AgentPath agent) throws ObjectNotFoundException, InvalidDataException { // copy properties -- intend to create from propdesc PropertyDescriptionList pdList = PropertyUtility.getPropertyDescriptionOutcome(itemPath, descVer); PropertyArrayList props = pdList.instantiate(initProps); @@ -147,7 +147,7 @@ public class CreateItemFromDescription extends PredefinedStep return props; } - protected CompositeActivity getNewWorkflow(ItemPath itemPath, String descVer) throws ObjectNotFound, InvalidData, PersistencyException { + protected CompositeActivity getNewWorkflow(ItemPath itemPath, String descVer) throws ObjectNotFoundException, InvalidDataException, PersistencyException { // find the workflow def for the given description version String wfDefName = null; Integer wfDefVer = null; @@ -159,26 +159,26 @@ public class CreateItemFromDescription extends PredefinedStep try { wfDefVer = Integer.parseInt(wfVerObj.toString()); } catch (NumberFormatException ex) { - throw new InvalidData("Invalid workflow version number: "+wfVerObj.toString()); + throw new InvalidDataException("Invalid workflow version number: "+wfVerObj.toString()); } // load workflow def if (wfDefName == null) - throw new InvalidData("No workflow given or defined"); + throw new InvalidDataException("No workflow given or defined"); if (wfDefVer == null) - throw new InvalidData("No workflow def version given"); + throw new InvalidDataException("No workflow def version given"); try { CompositeActivityDef wfDef = (CompositeActivityDef)LocalObjectLoader.getActDef(wfDefName, wfDefVer); return (CompositeActivity)wfDef.instantiate(); - } catch (ObjectNotFound ex) { - throw new InvalidData("Workflow def '"+wfDefName+"'v"+wfDefVer+" not found"); + } catch (ObjectNotFoundException ex) { + throw new InvalidDataException("Workflow def '"+wfDefName+"'v"+wfDefVer+" not found"); } catch (ClassCastException ex) { - throw new InvalidData("Activity def '"+wfDefName+"' was not Composite"); + throw new InvalidDataException("Activity def '"+wfDefName+"' was not Composite"); } } - protected CollectionArrayList getNewCollections(ItemPath itemPath, String descVer) throws ObjectNotFound, PersistencyException { + protected CollectionArrayList getNewCollections(ItemPath itemPath, String descVer) throws ObjectNotFoundException, PersistencyException { // loop through collections, collecting instantiated descriptions and finding the default workflow def CollectionArrayList colls = new CollectionArrayList(); String[] collNames = Gateway.getStorage().getClusterContents(itemPath, ClusterStorage.COLLECTION); diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/Erase.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/Erase.java index f96bc08..a34b202 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/Erase.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/Erase.java @@ -24,10 +24,10 @@ package com.c2kernel.lifecycle.instance.predefined.item; import java.util.Iterator; -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; @@ -54,7 +54,7 @@ public class Erase extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectNotFound, ObjectCannotBeUpdated, CannotManage, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, ObjectNotFoundException, ObjectCannotBeUpdated, CannotManageException, PersistencyException { Logger.msg(1, "Erase::request() - Starting."); diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/AddDomainContext.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/AddDomainContext.java index 57de2a1..e6bfba9 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/AddDomainContext.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/AddDomainContext.java @@ -23,9 +23,9 @@ package com.c2kernel.lifecycle.instance.predefined.server; import java.util.Arrays; import java.util.Stack; -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.lifecycle.instance.predefined.PredefinedStep; import com.c2kernel.lookup.AgentPath; @@ -42,15 +42,15 @@ public class AddDomainContext extends PredefinedStep { @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectCannotBeUpdated, ObjectAlreadyExists, CannotManage { + int transitionID, String requestData) throws InvalidDataException, ObjectCannotBeUpdated, ObjectAlreadyExistsException, CannotManageException { String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "AddDomainContext: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); - if (params.length != 1) throw new InvalidData("AddDomainContext: Invalid parameters "+Arrays.toString(params)); + if (params.length != 1) throw new InvalidDataException("AddDomainContext: Invalid parameters "+Arrays.toString(params)); DomainPath pathToAdd = new DomainPath(params); if (pathToAdd.exists()) - throw new ObjectAlreadyExists("Context "+pathToAdd+" already exists"); + throw new ObjectAlreadyExistsException("Context "+pathToAdd+" already exists"); // collect parent paths if they don't exist Stack pathsToAdd = new Stack(); while(pathToAdd!= null && !pathToAdd.exists()) { diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewAgent.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewAgent.java index ffe8950..92f4357 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewAgent.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewAgent.java @@ -20,11 +20,11 @@ */ package com.c2kernel.lifecycle.instance.predefined.server; -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.entity.imports.ImportAgent; import com.c2kernel.lifecycle.instance.predefined.PredefinedStep; import com.c2kernel.lookup.AgentPath; @@ -43,7 +43,7 @@ public class CreateNewAgent extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectNotFound, ObjectCannotBeUpdated, CannotManage, ObjectAlreadyExists { + int transitionID, String requestData) throws InvalidDataException, ObjectNotFoundException, ObjectCannotBeUpdated, CannotManageException, ObjectAlreadyExistsException { String redactedRequestData; @@ -52,7 +52,7 @@ public class CreateNewAgent extends PredefinedStep newAgent = (ImportAgent)Gateway.getMarshaller().unmarshall(requestData); } catch (Exception e1) { Logger.error(e1); - throw new InvalidData("CreateNewAgent: Couldn't unmarshall new Agent: "+requestData); + throw new InvalidDataException("CreateNewAgent: Couldn't unmarshall new Agent: "+requestData); } newAgent.create(agent, true); newAgent.setPassword("REDACTED"); @@ -60,7 +60,7 @@ public class CreateNewAgent extends PredefinedStep redactedRequestData = Gateway.getMarshaller().marshall(newAgent); } catch (Exception e) { Logger.error(e); - throw new InvalidData("CreateNewAgent: Couldn't marshall new Agent for outcome: "+newAgent); + throw new InvalidDataException("CreateNewAgent: Couldn't marshall new Agent for outcome: "+newAgent); } return redactedRequestData; } diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewItem.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewItem.java index 5e0505e..fde9f82 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewItem.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewItem.java @@ -23,12 +23,12 @@ package com.c2kernel.lifecycle.instance.predefined.server; -import com.c2kernel.common.CannotManage; +import com.c2kernel.common.CannotManageException; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectAlreadyExists; +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.entity.imports.ImportItem; import com.c2kernel.lifecycle.instance.predefined.PredefinedStep; import com.c2kernel.lookup.AgentPath; @@ -47,14 +47,14 @@ public class CreateNewItem extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectCannotBeUpdated, ObjectNotFound, CannotManage, ObjectAlreadyExists, InvalidCollectionModification { + int transitionID, String requestData) throws InvalidDataException, ObjectCannotBeUpdated, ObjectNotFoundException, CannotManageException, ObjectAlreadyExistsException, InvalidCollectionModification { ImportItem newItem; try { newItem = (ImportItem)Gateway.getMarshaller().unmarshall(requestData); } catch (Exception e) { Logger.error(e); - throw new InvalidData("CreateNewAgent: Couldn't unmarshall new Agent: "+requestData); + throw new InvalidDataException("CreateNewAgent: Couldn't unmarshall new Agent: "+requestData); } newItem.create(agent, false); return requestData; diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewRole.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewRole.java index de05dec..f99e54c 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewRole.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewRole.java @@ -20,11 +20,11 @@ */ package com.c2kernel.lifecycle.instance.predefined.server; -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.entity.imports.ImportRole; import com.c2kernel.lifecycle.instance.predefined.PredefinedStep; import com.c2kernel.lookup.AgentPath; @@ -43,7 +43,7 @@ public class CreateNewRole extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectAlreadyExists, ObjectCannotBeUpdated, CannotManage, ObjectNotFound { + int transitionID, String requestData) throws InvalidDataException, ObjectAlreadyExistsException, ObjectCannotBeUpdated, CannotManageException, ObjectNotFoundException { ImportRole newRole; @@ -51,7 +51,7 @@ public class CreateNewRole extends PredefinedStep newRole = (ImportRole)Gateway.getMarshaller().unmarshall(requestData); } catch (Exception e) { Logger.error(e); - throw new InvalidData("CreateNewAgent: Couldn't unmarshall new Agent: "+requestData); + throw new InvalidDataException("CreateNewAgent: Couldn't unmarshall new Agent: "+requestData); } newRole.create(agent, true); return requestData; diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/RemoveDomainContext.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/RemoveDomainContext.java index 2d78e69..a4520aa 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/RemoveDomainContext.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/RemoveDomainContext.java @@ -22,10 +22,10 @@ package com.c2kernel.lifecycle.instance.predefined.server; 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.DomainPath; @@ -40,20 +40,20 @@ public class RemoveDomainContext 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, "RemoveDomainContext: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); - if (params.length != 1) throw new InvalidData("RemoveDomainContext: Invalid parameters "+Arrays.toString(params)); + if (params.length != 1) throw new InvalidDataException("RemoveDomainContext: Invalid parameters "+Arrays.toString(params)); DomainPath pathToDelete = new DomainPath(params[0]); if (!pathToDelete.exists()) - throw new ObjectNotFound("Context "+pathToDelete+" does not exist"); + throw new ObjectNotFoundException("Context "+pathToDelete+" does not exist"); try { pathToDelete.getItemPath(); - throw new InvalidData("Path "+pathToDelete+" is an Entity. Use its own Erase step instead, or RemoveAgent."); - } catch (ObjectNotFound ex) { } + throw new InvalidDataException("Path "+pathToDelete+" is an Entity. Use its own Erase step instead, or RemoveAgent."); + } catch (ObjectNotFoundException ex) { } if (Gateway.getLookup().getChildren(pathToDelete).hasNext()) throw new ObjectCannotBeUpdated("Context "+pathToDelete+" is not empty. Cannot delete."); diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/RemoveRole.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/RemoveRole.java index 7aeda55..a75b98c 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/RemoveRole.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/RemoveRole.java @@ -22,10 +22,10 @@ package com.c2kernel.lifecycle.instance.predefined.server; 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.ItemPath; @@ -44,11 +44,11 @@ public class RemoveRole extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, CannotManage, ObjectNotFound, ObjectCannotBeUpdated { + int transitionID, String requestData) throws InvalidDataException, CannotManageException, ObjectNotFoundException, ObjectCannotBeUpdated { String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "RemoveRole: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); - if (params.length != 1) throw new InvalidData("RemoveRole: Invalid parameters "+Arrays.toString(params)); + if (params.length != 1) throw new InvalidDataException("RemoveRole: Invalid parameters "+Arrays.toString(params)); LookupManager lookup = Gateway.getLookupManager(); diff --git a/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java b/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java index 54a7267..cd61713 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java @@ -25,9 +25,9 @@ import java.util.HashMap; import java.util.Map; import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.lifecycle.instance.Activity; import com.c2kernel.lookup.AgentPath; import com.c2kernel.utils.DescriptionObject; @@ -142,7 +142,7 @@ public class StateMachine implements DescriptionObject return stateCodes.get(stateID); } - public Map getPossibleTransitions(Activity act, AgentPath agent) throws ObjectNotFound, InvalidData { + public Map getPossibleTransitions(Activity act, AgentPath agent) throws ObjectNotFoundException, InvalidDataException { HashMap returnList = new HashMap(); State currentState = getState(act.getState()); for (Integer transCode : currentState.getPossibleTransitionIds()) { @@ -158,14 +158,14 @@ public class StateMachine implements DescriptionObject return returnList; } - public State traverse(Activity act, Transition transition, AgentPath agent) throws InvalidTransition, AccessRightsException, ObjectNotFound, InvalidData { + public State traverse(Activity act, Transition transition, AgentPath agent) throws InvalidTransitionException, AccessRightsException, ObjectNotFoundException, InvalidDataException { State currentState = getState(act.getState()); if (transition.originState.equals(currentState)) { transition.getPerformingRole(act, agent); return transition.targetState; } else - throw new InvalidTransition("Transition '"+transition.getName()+"' not valid from state '"+currentState.getName()); + throw new InvalidTransitionException("Transition '"+transition.getName()+"' not valid from state '"+currentState.getName()); } diff --git a/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/Transition.java b/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/Transition.java index 78786da..76ae602 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/Transition.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/Transition.java @@ -25,8 +25,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import com.c2kernel.common.AccessRightsException; -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.Activity; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.RolePath; @@ -188,7 +188,7 @@ public class Transition { this.targetStateId = targetStateId; } - public String getPerformingRole(Activity act, AgentPath agent) throws ObjectNotFound, AccessRightsException { + public String getPerformingRole(Activity act, AgentPath agent) throws ObjectNotFoundException, AccessRightsException { // check available if (!isEnabled(act.getProperties())) @@ -284,13 +284,13 @@ public class Transition { return true; } - public Schema getSchema(CastorHashMap actProps) throws InvalidData, ObjectNotFound { + public Schema getSchema(CastorHashMap actProps) throws InvalidDataException, ObjectNotFoundException { if (hasOutcome(actProps)) try { return LocalObjectLoader.getSchema(resolveValue(outcome.schemaName, actProps), Integer.parseInt(resolveValue(outcome.schemaVersion, actProps))); } catch (NumberFormatException ex) { - throw new InvalidData("Bad schema version number: "+outcome.schemaVersion+" ("+resolveValue(outcome.schemaVersion, actProps)+")"); + throw new InvalidDataException("Bad schema version number: "+outcome.schemaVersion+" ("+resolveValue(outcome.schemaVersion, actProps)+")"); } else return null; @@ -300,11 +300,11 @@ public class Transition { return resolveValue(script.scriptName, actProps); } - public int getScriptVersion(CastorHashMap actProps) throws InvalidData { + public int getScriptVersion(CastorHashMap actProps) throws InvalidDataException { try { return Integer.parseInt(resolveValue(script.scriptVersion, actProps)); } catch (NumberFormatException ex) { - throw new InvalidData("Bad Script version number: "+script.scriptVersion+" ("+resolveValue(script.scriptVersion, actProps)+")"); + throw new InvalidDataException("Bad Script version number: "+script.scriptVersion+" ("+resolveValue(script.scriptVersion, actProps)+")"); } } -- cgit v1.2.3