[jboss-svn-commits] JBL Code SVN: r16172 - labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Oct 30 15:26:46 EDT 2007
Author: mark.little at jboss.com
Date: 2007-10-30 15:26:46 -0400 (Tue, 30 Oct 2007)
New Revision: 16172
Modified:
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/CommandInterpreter.java
Log:
http://jira.jboss.com/jira/browse/JBESB-1213
Modified: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/CommandInterpreter.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/CommandInterpreter.java 2007-10-30 18:46:02 UTC (rev 16171)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/CommandInterpreter.java 2007-10-30 19:26:46 UTC (rev 16172)
@@ -26,6 +26,7 @@
import org.jboss.soa.esb.actions.ActionLifecycle;
import org.jboss.soa.esb.actions.ActionLifecycleException;
import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.actions.ActionProcessingFaultException;
import org.jboss.soa.esb.addressing.MalformedEPRException;
import org.jboss.soa.esb.couriers.CourierException;
import org.jboss.soa.esb.helpers.ConfigTree;
@@ -65,6 +66,17 @@
checkMyParms();
} // ________________________________
+ /**
+ * If the end state is reached within a jBPM process, then the ESB will propagate back
+ * an appropriate error message to the sender.
+ *
+ * @param message
+ * @return
+ * @throws MalformedEPRException
+ * @throws CourierException
+ * @throws ActionProcessingException
+ */
+
public Message process(Message message)
throws MalformedEPRException, CourierException, ActionProcessingException
{
@@ -73,6 +85,19 @@
{
response = CommandExecutorFactory.getInstance().getExecutor(message).execute(message);
}
+ catch (JbpmException e)
+ {
+ _logger.error(e.getMessage(), e);
+
+ if (endState(e))
+ {
+ _logger.info("End-state reached for jBPM process.");
+
+ throw new ActionProcessingFaultException("jBPM end state reached!");
+ }
+ else
+ throw new ActionProcessingException(e.getMessage(), e);
+ }
catch (Exception e)
{
_logger.error(e.getMessage(), e);
@@ -96,6 +121,9 @@
}
catch (JbpmException e)
{
+ // why do we do this when response will clearly not be returned?!
+ // http://jira.jboss.com/jira/browse/JBESB-1272
+
body.add(Constants.RETURN_CODE, Constants.RETCODE_EXCEPTION);
body.add(Constants.EXCEPTION, e);
throw e;
@@ -170,6 +198,28 @@
private static JbpmConfiguration s_jbpmConfig;
private static CommandService s_jbpmService;
+ private final String END_STATE = "couldn't signal token 'Token(/)' : node 'EndState(end-state1)'";
+
+ /*
+ * Would be nice if JbpmExceptions contained a fault code. Or had more subclasses
+ * of JbpmException.
+ */
+
+ private final boolean endState (JbpmException ex)
+ {
+ Throwable thrw = ex;
+
+ while (thrw != null)
+ {
+ if (thrw.getMessage().contains(END_STATE))
+ return true;
+ else
+ thrw = thrw.getCause();
+ }
+
+ return false;
+ }
+
public interface CommandExecutor
{
public Message execute (Message message) throws Exception;
More information about the jboss-svn-commits
mailing list