From 275d0bbf555c8917be82ce4cc21eb4cabb00f4c5 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 3 Oct 2014 17:30:41 +0200 Subject: 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. --- .../lifecycle/instance/CompositeActivity.java | 44 ++++++++++++++-------- 1 file changed, 28 insertions(+), 16 deletions(-) (limited to 'src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java') 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 calculateJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws ObjectNotFoundException, InvalidDataException, InvalidAgentPathException + public ArrayList calculateJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFound, InvalidData { ArrayList jobs = new ArrayList(); boolean childActive = false; @@ -354,7 +366,7 @@ public class CompositeActivity extends Activity } @Override - public ArrayList calculateAllJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws ObjectNotFoundException, InvalidDataException, InvalidAgentPathException + public ArrayList calculateAllJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFound, InvalidData { ArrayList jobs = new ArrayList(); 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); -- cgit v1.2.3