summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2014-10-03 17:30:41 +0200
committerAndrew Branson <andrew.branson@cern.ch>2014-10-03 17:30:41 +0200
commit275d0bbf555c8917be82ce4cc21eb4cabb00f4c5 (patch)
treeddcc6b14077d90d1b970b67829f07120547dbb62 /src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java
parenta139f95bfeca603333b8c0310ae09c6805e58584 (diff)
Huge exception overhaul: Merged ClusterStorageException with
PersistencyException. Replaced MembershipException with InvalidCollectionModification CORBA Exception. Made all predef steps throw more accurate exceptions when they go wrong, and let more exceptions bubble through from underneath.
Diffstat (limited to 'src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java')
-rw-r--r--src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java44
1 files changed, 28 insertions, 16 deletions
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java b/src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java
index 6299633..8e08f99 100644
--- a/src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java
+++ b/src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java
@@ -23,9 +23,13 @@ package com.c2kernel.lifecycle.instance;
import java.util.ArrayList;
import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.common.ObjectNotFoundException;
+import com.c2kernel.common.CannotManage;
+import com.c2kernel.common.InvalidCollectionModification;
+import com.c2kernel.common.InvalidData;
+import com.c2kernel.common.InvalidTransition;
+import com.c2kernel.common.ObjectAlreadyExists;
+import com.c2kernel.common.ObjectCannotBeUpdated;
+import com.c2kernel.common.ObjectNotFound;
import com.c2kernel.common.PersistencyException;
import com.c2kernel.entity.agent.Job;
import com.c2kernel.graph.model.GraphModel;
@@ -302,15 +306,17 @@ public class CompositeActivity extends Activity
}
/**
- * @throws InvalidDataException
- * @throws ObjectNotFoundException
+ * @throws InvalidData
+ * @throws ObjectNotFound
* @throws AccessRightsException
- * @throws InvalidTransitionException
+ * @throws InvalidTransition
* @throws PersistencyException
+ * @throws ObjectAlreadyExists
+ * @throws ObjectCannotBeUpdated
* @see com.c2kernel.lifecycle.instance.WfVertex#run()
*/
@Override
- public void run(AgentPath agent, ItemPath itemPath) throws InvalidDataException, InvalidTransitionException, AccessRightsException, ObjectNotFoundException, PersistencyException
+ public void run(AgentPath agent, ItemPath itemPath) throws InvalidData
{
super.run(agent, itemPath);
if (getChildrenGraphModel().getStartVertex() != null && !getStateMachine().getState(state).isFinished())
@@ -321,22 +327,28 @@ public class CompositeActivity extends Activity
}
@Override
- public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidDataException, AccessRightsException, InvalidTransitionException, ObjectNotFoundException, PersistencyException
+ public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidData
{
if (!getStateMachine().getState(state).isFinished())
- request(agent, itemPath, CompositeActivity.COMPLETE, null);
+ try {
+ request(agent, itemPath, CompositeActivity.COMPLETE, null);
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ Logger.error(e); // current agent couldn't complete the composite, so leave it
+ }
super.runNext(agent, itemPath);
}
/**
- * @throws InvalidDataException
- * @throws ObjectNotFoundException
+ * @throws InvalidData
+ * @throws ObjectNotFound
* @throws InvalidAgentPathException
* @see com.c2kernel.lifecycle.instance.Activity#calculateJobs()
*/
@Override
- public ArrayList<Job> calculateJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws ObjectNotFoundException, InvalidDataException, InvalidAgentPathException
+ public ArrayList<Job> calculateJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFound, InvalidData
{
ArrayList<Job> jobs = new ArrayList<Job>();
boolean childActive = false;
@@ -354,7 +366,7 @@ public class CompositeActivity extends Activity
}
@Override
- public ArrayList<Job> calculateAllJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws ObjectNotFoundException, InvalidDataException, InvalidAgentPathException
+ public ArrayList<Job> calculateAllJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFound, InvalidData
{
ArrayList<Job> jobs = new ArrayList<Job>();
if (recurse)
@@ -424,11 +436,11 @@ public class CompositeActivity extends Activity
}
/**
- * @throws InvalidDataException
+ * @throws InvalidData
*
*/
@Override
- public void reinit(int idLoop) throws InvalidDataException
+ public void reinit(int idLoop) throws InvalidData
{
super.reinit(idLoop);
if (getChildrenGraphModel().getStartVertex() != null && !getStateMachine().getState(state).isFinished())
@@ -436,7 +448,7 @@ public class CompositeActivity extends Activity
}
@Override
- public String request(AgentPath agent, ItemPath itemPath, int transitionID, String requestData) throws AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectNotFoundException, PersistencyException
+ public String request(AgentPath agent, ItemPath itemPath, int transitionID, String requestData) throws AccessRightsException, InvalidTransition, InvalidData, ObjectNotFound, PersistencyException, ObjectAlreadyExists, ObjectCannotBeUpdated, CannotManage, InvalidCollectionModification
{
if (getChildrenGraphModel().getStartVertex() != null && !getStateMachine().getState(state).isFinished() && transitionID == CompositeActivity.START)
((WfVertex) getChildrenGraphModel().getStartVertex()).run(agent, itemPath);