[jboss-svn-commits] JBL Code SVN: r11310 - in labs/jbossesb/trunk/product/services/jbpm/src: main/java/org/jboss/soa/esb/services/jbpm/actions and 3 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Apr 24 14:47:25 EDT 2007
Author: estebanschifman
Date: 2007-04-24 14:47:25 -0400 (Tue, 24 Apr 2007)
New Revision: 11310
Added:
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/DeployProcessDefinitionFacade.java
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/FacadeUtil.java
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/GetProcessInstanceFacade.java
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/GetTaskInstanceFacade.java
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/GetTaskListFacade.java
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/NewProcessInstanceFacade.java
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/SignalFacade.java
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/StartWorkOnTaskFacade.java
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/TaskInstanceEndFacade.java
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/VariableMapping.java
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/VariablesFacade.java
Removed:
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/internal/
Modified:
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/CommandExecutorFactory.java
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/impl/DefaultCommandExecutorFactoryImpl.java
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/DefaultMessageFacadeFactoryImpl.java
labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/CommandInterpreterUnitTest.java
labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/EsbActionHandlerUnitTest.java
labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/SingleCommandProcessorUnitTest.java
Log:
Rename packages, methods
Modified: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/CommandExecutorFactory.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/CommandExecutorFactory.java 2007-04-24 18:32:27 UTC (rev 11309)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/CommandExecutorFactory.java 2007-04-24 18:47:25 UTC (rev 11310)
@@ -32,7 +32,7 @@
{
public abstract CommandInterpreter.CommandExecutor
- getPerformer(Message message) throws Exception;
+ getExecutor(Message message) throws Exception;
protected static final Object s_oSynch = new Integer(0);
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-04-24 18:32:27 UTC (rev 11309)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/CommandInterpreter.java 2007-04-24 18:47:25 UTC (rev 11310)
@@ -73,7 +73,7 @@
Message response = null;
try
{
- response = CommandExecutorFactory.getInstance().getPerformer(message).execute(message);
+ response = CommandExecutorFactory.getInstance().getExecutor(message).execute(message);
}
catch (Exception e)
{
Modified: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/DefaultCommandExecutorFactoryImpl.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/DefaultCommandExecutorFactoryImpl.java 2007-04-24 18:32:27 UTC (rev 11309)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/DefaultCommandExecutorFactoryImpl.java 2007-04-24 18:47:25 UTC (rev 11310)
@@ -61,15 +61,10 @@
public class DefaultCommandExecutorFactoryImpl extends CommandExecutorFactory
{
- private static final String DO_NOT_USE_CREATE_SCHEMA ="DONOTUSE_createSchema";
-
@Override
- public CommandExecutor getPerformer(Message message) throws Exception
+ public CommandExecutor getExecutor(Message message) throws Exception
{
String strCommand = (String)message.getBody().get(Constants.COMMAND_CODE);
- if (DO_NOT_USE_CREATE_SCHEMA.equals(strCommand))
- return CREATE_SCHEMA_PERFORMER;
-
Constants.OpCode opCode = Constants.OpCode.valueOf(strCommand);
CommandExecutor ret = _values.get(opCode);
if (null==ret)
@@ -79,37 +74,6 @@
protected Logger _logger = Logger.getLogger(this.getClass());
- /**
- * Do NOT NOT NOT use the following performer - only for test/debug purposess
- */
- private static Boolean s_schemaAlreadyCreated = false;
- private static CommandExecutor CREATE_SCHEMA_PERFORMER = new CommandExecutor()
- {
- public Message execute(Message request) throws Exception
- {
- Message response = CommandInterpreter.doTheJob(
- new Command()
- {
- private static final long serialVersionUID = 1L;
- public Object execute(JbpmContext jbpmCtx) throws Exception
- {
- if (! s_schemaAlreadyCreated)
- synchronized (s_oSynch)
- {
- if (! s_schemaAlreadyCreated)
- {
- jbpmCtx.getJbpmConfiguration().createSchema();
- s_schemaAlreadyCreated = true;
- }
- }
- return null;
- }
- });
- // No values other than the completion code are returned by this command
- return response;
- };
- };
-
protected static final CommandExecutor DEPLOY_PROCESS_DEF_EXECUTOR = new CommandExecutor()
{
public Message execute(Message request) throws Exception
Modified: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/DefaultMessageFacadeFactoryImpl.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/DefaultMessageFacadeFactoryImpl.java 2007-04-24 18:32:27 UTC (rev 11309)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/DefaultMessageFacadeFactoryImpl.java 2007-04-24 18:47:25 UTC (rev 11310)
@@ -30,15 +30,15 @@
import org.jboss.soa.esb.services.jbpm.actions.MessageFacadeFactory;
import org.jboss.soa.esb.services.jbpm.actions.SingleCommandProcessor;
import org.jboss.soa.esb.services.jbpm.actions.SingleCommandProcessor.MessageFacade;
-import org.jboss.soa.esb.services.jbpm.internal.facades.DeployProcessDefinitionFacade;
-import org.jboss.soa.esb.services.jbpm.internal.facades.GetProcessInstanceFacade;
-import org.jboss.soa.esb.services.jbpm.internal.facades.GetTaskInstanceFacade;
-import org.jboss.soa.esb.services.jbpm.internal.facades.GetTaskListFacade;
-import org.jboss.soa.esb.services.jbpm.internal.facades.NewProcessInstanceFacade;
-import org.jboss.soa.esb.services.jbpm.internal.facades.SignalFacade;
-import org.jboss.soa.esb.services.jbpm.internal.facades.StartWorkOnTaskFacade;
-import org.jboss.soa.esb.services.jbpm.internal.facades.TaskInstanceEndFacade;
-import org.jboss.soa.esb.services.jbpm.internal.facades.VariablesFacade;
+import org.jboss.soa.esb.services.jbpm.actions.impl.facades.DeployProcessDefinitionFacade;
+import org.jboss.soa.esb.services.jbpm.actions.impl.facades.GetProcessInstanceFacade;
+import org.jboss.soa.esb.services.jbpm.actions.impl.facades.GetTaskInstanceFacade;
+import org.jboss.soa.esb.services.jbpm.actions.impl.facades.GetTaskListFacade;
+import org.jboss.soa.esb.services.jbpm.actions.impl.facades.NewProcessInstanceFacade;
+import org.jboss.soa.esb.services.jbpm.actions.impl.facades.SignalFacade;
+import org.jboss.soa.esb.services.jbpm.actions.impl.facades.StartWorkOnTaskFacade;
+import org.jboss.soa.esb.services.jbpm.actions.impl.facades.TaskInstanceEndFacade;
+import org.jboss.soa.esb.services.jbpm.actions.impl.facades.VariablesFacade;
/**
* Default implementation of a message preprocessor factory
Copied: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/DeployProcessDefinitionFacade.java (from rev 11309, labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/internal/facades/DeployProcessDefinitionFacade.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/DeployProcessDefinitionFacade.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/DeployProcessDefinitionFacade.java 2007-04-24 18:47:25 UTC (rev 11310)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.services.jbpm.actions.impl.facades;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.jbpm.Constants;
+import org.jboss.soa.esb.services.jbpm.Constants.OpCode;
+import org.jboss.soa.esb.services.jbpm.actions.SingleCommandProcessor;
+import org.jboss.soa.esb.util.Util;
+import org.jbpm.graph.def.ProcessDefinition;
+
+/**
+ *
+ * Implementation of a message preprocessor that obtains the process definition
+ * from the action configuration XML
+ *
+ * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
+ */
+public class DeployProcessDefinitionFacade implements SingleCommandProcessor.MessageFacade
+{
+ public OpCode getOpCode() { return Constants.OpCode.DeployProcessDefinition; }
+
+ public DeployProcessDefinitionFacade(ConfigTree config) throws ConfigurationException
+ {
+ ConfigTree[] childs = config.getChildren(Constants.PROCESS_DEFINITION_XML_TAG);
+ if (null==childs || childs.length<1)
+ throw new ConfigurationException("Missing or invalid <"+Constants.PROCESS_DEFINITION_XML_TAG+"> element");
+ if (childs.length>1)
+ throw new ConfigurationException("Only one <"+Constants.PROCESS_DEFINITION_XML_TAG+"> element can be specified");
+
+ String version = childs[0].getAttribute("version");
+ String encoding = childs[0].getAttribute("encoding");
+ if (Util.isNullString(version) || Util.isNullString(encoding))
+ throw new ConfigurationException("Wrong 'version' or 'encoding' attribute in <"+Constants.PROCESS_DEFINITION_XML_TAG+">");
+ StringBuilder sb = new StringBuilder("<?xml version='").append(version)
+ .append("' encoding='").append(encoding).append("' ?>\n")
+ ;
+
+ ConfigTree[] def = childs[0].getChildren("process-definition");
+ if (null==def || def.length<1)
+ throw new ConfigurationException("Missing or invalid <process-definition> element");
+ if (def.length>1)
+ throw new ConfigurationException("Only one <process-definition> element can be specified");
+
+ final String xmlString = sb.append(def[0].toString()).toString();
+ try
+ {
+ _processDef = ProcessDefinition.parseXmlString(xmlString);
+ }
+ catch (Exception e)
+ {
+ throw new ConfigurationException(e);
+ }
+ } // ________________________________
+
+ public void preFormat(Message message)
+ {
+ message.getBody().add(Constants.PROCESS_DEFINITION, _processDef);
+ } // ________________________________
+
+ public Message postFormat(Message message)
+ {
+
+ return message;
+ } // ________________________________
+
+ ProcessDefinition _processDef;
+}
Copied: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/FacadeUtil.java (from rev 11309, labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/internal/facades/FacadeUtil.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/FacadeUtil.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/FacadeUtil.java 2007-04-24 18:47:25 UTC (rev 11310)
@@ -0,0 +1,153 @@
+package org.jboss.soa.esb.services.jbpm.actions.impl.facades;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.jbpm.Constants;
+import org.jboss.soa.esb.services.jbpm.actions.SingleCommandProcessor;
+import org.jboss.soa.esb.util.Util;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.taskmgmt.exe.TaskInstance;
+
+public class FacadeUtil
+{
+ static Boolean booleanFromConfig(ConfigTree tree, String tag)
+ throws ConfigurationException
+ {
+ ConfigTree[] childs = tree.getChildren(tag);
+ if (null==childs || childs.length<1)
+ return null;
+ if (childs.length>1)
+ throw new ConfigurationException("Only one <"+tag
+ +"> element allowed in configuration");
+ try
+ {
+ return Boolean.parseBoolean(childs[0].getAttribute("value"));
+ }
+ catch (Exception e)
+ {
+ throw new ConfigurationException("<"+tag
+ +"> must have a 'value' attribute containing 'true' or 'false'");
+ }
+ } //________________________________
+
+ static VariableMapping variablesFromConfig(ConfigTree tree, boolean acceptValue)
+ throws ConfigurationException
+ {
+ String tag = Constants.VARIABLES_TAG;
+ ConfigTree[] childs = tree.getChildren(tag);
+ if (null==childs || childs.length<1)
+ return null;
+ if (childs.length>1)
+ throw new ConfigurationException("Only one <"+tag
+ +"> element allowed in configuration");
+
+ tag = Constants.ONE_VARIABLE_TAG;
+ childs = childs[0].getChildren(tag);
+ if (null==childs || childs.length<1)
+ throw new ConfigurationException("At least one <"+tag
+ +"> child element required for <"+Constants.VARIABLES_TAG+">");
+ VariableMapping ret = new VariableMapping();
+ for (ConfigTree curr: childs)
+ {
+ String name = curr.getAttribute("name");
+ String esbName = curr.getAttribute(Constants.ESB_VARNAME_TAG);
+ String jbpmName = curr.getAttribute(Constants.JBPM_VARNAME_TAG);
+ if (null!=name)
+ {
+ if (null!=esbName || null!=jbpmName)
+ throw new ConfigurationException("When 'name' is specified, neither '"
+ +Constants.JBPM_VARNAME_TAG+"' nor"
+ +Constants.ESB_VARNAME_TAG +"' are accepted");
+ esbName = jbpmName = name;
+ }
+ else
+ {
+ if (Util.isNullString(esbName) || Util.isNullString(jbpmName))
+ throw new ConfigurationException("Either 'name' or the pair '"
+ +Constants.JBPM_VARNAME_TAG+"' and"
+ +Constants.ESB_VARNAME_TAG +"' must be specified");
+ }
+ String value = curr.getAttribute("value");
+ if (acceptValue)
+ {
+ if (null==value)
+ throw new ConfigurationException("'value' attribute is required for the '"
+ +tree.getAttribute(SingleCommandProcessor.COMMAND_ATTRIBUTE_TAG)
+ +"' command");
+ }
+ else
+ {
+ if (null!=value)
+ throw new ConfigurationException("'value' attribute is incompatible with the '"
+ +tree.getAttribute(SingleCommandProcessor.COMMAND_ATTRIBUTE_TAG)
+ +"' command");
+ }
+ // add entry even if value is null, so we'll have mapping anyways
+ ret.setVariable(esbName, jbpmName, value);
+ }
+ return ret;
+ } //________________________________
+
+ static String[] actorsFromConfig(ConfigTree tree, boolean acceptValue)
+ throws ConfigurationException
+ {
+ String tag = Constants.ACTORS_TAG;
+ ConfigTree[] childs = tree.getChildren(tag);
+ if (null==childs || childs.length<1)
+ return null;
+ if (childs.length>1)
+ throw new ConfigurationException("Only one <"+tag
+ +"> element allowed in configuration");
+
+ tag = Constants.ONE_ACTOR_TAG;
+ childs = childs[0].getChildren(tag);
+ if (null==childs || childs.length<1)
+ throw new ConfigurationException("At least one <"+tag
+ +"> child element required for <"+Constants.VARIABLES_TAG+">");
+ String[] ret = new String[childs.length];
+ int i1=0;
+ for (ConfigTree curr: childs)
+ {
+ String name = curr.getAttribute("name");
+ if (null==name)
+ {
+ throw new ConfigurationException
+ ("You must specifi the 'name' attribute for all <"
+ +tag+"> element");
+ }
+ ret[i1++] = name;
+ }
+ return ret;
+ } //________________________________
+
+ static void jbpmVarsToMessage(Message message, VariableMapping mapping)
+ {
+ Body body = message.getBody();
+ Object obj = body.get(Constants.JBPM_RETURN_OBJECT);
+ if (null==obj)
+ return;
+
+ Map map = null;
+ if (obj instanceof ProcessInstance)
+ map= ((ProcessInstance)obj).getContextInstance().getVariables();
+ else if (obj instanceof TaskInstance)
+ map = ((TaskInstance)obj).getContextInstance().getVariables();
+ else
+ throw new IllegalArgumentException("Unknown return jbpmObject in message");
+
+ for (Iterator II = map.entrySet().iterator(); II.hasNext();)
+ {
+ Map.Entry curr = (Map.Entry)II.next();
+ String keyInMsg = (null==mapping) ? (String)curr.getKey()
+ : mapping.getEsbName((String)curr.getKey());
+ if (null!=curr.getValue())
+ body.add(keyInMsg, curr.getValue());
+ }
+ } // ________________________________
+
+}
Copied: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/GetProcessInstanceFacade.java (from rev 11309, labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/internal/facades/GetProcessInstanceFacade.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/GetProcessInstanceFacade.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/GetProcessInstanceFacade.java 2007-04-24 18:47:25 UTC (rev 11310)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.services.jbpm.actions.impl.facades;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.jbpm.Constants;
+import org.jboss.soa.esb.services.jbpm.Constants.OpCode;
+import org.jboss.soa.esb.services.jbpm.actions.SingleCommandProcessor;
+
+/**
+ *
+ * Implementation of a message preprocessor to obtain data from a process instance
+ * from the action configuration XML
+ *
+ * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
+ */
+public class GetProcessInstanceFacade implements SingleCommandProcessor.MessageFacade
+{
+ public OpCode getOpCode() { return Constants.OpCode.GetProcessInstanceCommand; }
+
+ public GetProcessInstanceFacade(ConfigTree config) throws ConfigurationException
+ {
+ _includeAllVars = FacadeUtil.booleanFromConfig(config,Constants.INCLUDE_ALL_VARS_TAG);
+ _includeLogs = FacadeUtil.booleanFromConfig(config,Constants.INCLUDE_LOGS_TAG);
+ _variables = FacadeUtil.variablesFromConfig(config, false);
+ } // ________________________________
+
+ public void preFormat(Message message)
+ {
+ Body body = message.getBody();
+ if (null!=_includeLogs)
+ body.add(Constants.INCLUDE_LOGS ,_includeLogs);
+
+ String key = Constants.INCLUDE_ALL_VARS_TAG;
+ // Currently, the jbpm GetProcessInstanceCommand does not accept a list of variables
+ // so, if configuration has a list of variables, we must bring'em all
+ if (null!=_variables)
+ body.add(key, true);
+ else if (null!=_includeAllVars)
+ body.add(key,_includeAllVars);
+ } // _______________________________
+
+ public Message postFormat(Message response)
+ {
+ if (null!=_variables)
+ FacadeUtil.jbpmVarsToMessage(response,_variables);
+ else if (null!=_includeAllVars && _includeAllVars)
+ FacadeUtil.jbpmVarsToMessage(response,null);
+ return response;
+ } // ________________________________
+
+ Boolean _includeLogs;
+ Boolean _includeAllVars;
+ VariableMapping _variables;
+}
Copied: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/GetTaskInstanceFacade.java (from rev 11309, labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/internal/facades/GetTaskInstanceFacade.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/GetTaskInstanceFacade.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/GetTaskInstanceFacade.java 2007-04-24 18:47:25 UTC (rev 11310)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.services.jbpm.actions.impl.facades;
+
+import java.util.Map;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.jbpm.Constants;
+import org.jboss.soa.esb.services.jbpm.Constants.OpCode;
+import org.jboss.soa.esb.services.jbpm.actions.SingleCommandProcessor;
+
+/**
+ *
+ * Implementation of a message preprocessor to obtain data from a token instance
+ * from the action configuration XML
+ *
+ * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
+ */
+public class GetTaskInstanceFacade implements SingleCommandProcessor.MessageFacade
+{
+ public OpCode getOpCode() { return Constants.OpCode.GetTaskInstanceCommand; }
+
+ public GetTaskInstanceFacade(ConfigTree config) throws ConfigurationException
+ {
+ _includeAllVars = FacadeUtil.booleanFromConfig(config,Constants.INCLUDE_ALL_VARS_TAG);
+ _includeLogs = FacadeUtil.booleanFromConfig(config,Constants.INCLUDE_LOGS_TAG);
+ _variables = FacadeUtil.variablesFromConfig(config, false);
+ _actors = FacadeUtil.actorsFromConfig(config, false);
+ } // ________________________________
+
+ public void preFormat(Message message)
+ {
+ Body body = message.getBody();
+ if (null!=_includeLogs)
+ body.add(Constants.INCLUDE_LOGS ,_includeLogs);
+ if (null!=_includeAllVars)
+ body.add(Constants.INCLUDE_ALL_VARS_TAG ,_includeAllVars);
+ if (null!=_variables)
+ {
+ String[] sa = new String[_variables.size()];
+ int i1=0;
+ for(Map.Entry<String,Object> curr:_variables.esbVariables().entrySet())
+ sa[i1++] = _variables.getJbpmName(curr.getKey());
+ body.add(Constants.VARIABLE_NAMES_ARRAY, sa);
+ }
+ } // _______________________________
+
+ public Message postFormat(Message response)
+ {
+ if (null!=_variables)
+ FacadeUtil.jbpmVarsToMessage(response,_variables);
+ else if (null!=_includeAllVars && _includeAllVars)
+ FacadeUtil.jbpmVarsToMessage(response,null);
+ return response;
+ } // ________________________________
+
+ Boolean _includeLogs;
+ Boolean _includeAllVars;
+ VariableMapping _variables;
+ String[] _actors;
+}
Copied: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/GetTaskListFacade.java (from rev 11309, labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/internal/facades/GetTaskListFacade.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/GetTaskListFacade.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/GetTaskListFacade.java 2007-04-24 18:47:25 UTC (rev 11310)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.services.jbpm.actions.impl.facades;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.jbpm.Constants;
+import org.jboss.soa.esb.services.jbpm.Constants.OpCode;
+import org.jboss.soa.esb.services.jbpm.actions.SingleCommandProcessor;
+import org.jbpm.taskmgmt.exe.TaskInstance;
+
+/**
+ *
+ * Implementation of a message preprocessor to obtain data from a token instance
+ * from the action configuration XML
+ *
+ * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
+ */
+public class GetTaskListFacade implements SingleCommandProcessor.MessageFacade
+{
+ public OpCode getOpCode() { return Constants.OpCode.GetTaskListCommand; }
+
+ public GetTaskListFacade(ConfigTree config) throws ConfigurationException
+ {
+ _includeAllVars = FacadeUtil.booleanFromConfig(config,Constants.INCLUDE_ALL_VARS_TAG);
+ _includeLogs = FacadeUtil.booleanFromConfig(config,Constants.INCLUDE_LOGS_TAG);
+ _variables = FacadeUtil.variablesFromConfig(config, false);
+ _actors = FacadeUtil.actorsFromConfig(config, false);
+ } // ________________________________
+
+ public void preFormat(Message message)
+ {
+ Body body = message.getBody();
+ if (null!=_includeLogs)
+ body.add(Constants.INCLUDE_LOGS ,_includeLogs);
+ if (null!=_includeAllVars)
+ body.add(Constants.INCLUDE_ALL_VARS_TAG ,_includeAllVars);
+ if (null!=_variables)
+ {
+ String[] sa = new String[_variables.size()];
+ int i1=0;
+ for(Map.Entry<String,Object> curr:_variables.esbVariables().entrySet())
+ sa[i1++] = _variables.getJbpmName(curr.getKey());
+ body.add(Constants.VARIABLE_NAMES_ARRAY, sa);
+ }
+ } // _______________________________
+
+ public Message postFormat(Message response)
+ {
+ Body body = response.getBody();
+ Object obj = body.get(Constants.JBPM_RETURN_OBJECT);
+ if (obj instanceof List)
+ {
+ List<Long>taskIdList = new ArrayList<Long>();
+ for (Object curr: (List)obj)
+ if (curr instanceof TaskInstance)
+ taskIdList.add(((TaskInstance)curr).getId());
+ if (taskIdList.size() > 0)
+ body.add(Constants.TASK_ID_LIST, taskIdList);
+ }
+ return response;
+ } // ________________________________
+
+ Boolean _includeLogs;
+ Boolean _includeAllVars;
+ VariableMapping _variables;
+ String[] _actors;
+}
Copied: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/NewProcessInstanceFacade.java (from rev 11309, labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/internal/facades/NewProcessInstanceFacade.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/NewProcessInstanceFacade.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/NewProcessInstanceFacade.java 2007-04-24 18:47:25 UTC (rev 11310)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.services.jbpm.actions.impl.facades;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.jbpm.Constants;
+import org.jboss.soa.esb.services.jbpm.Constants.OpCode;
+import org.jboss.soa.esb.services.jbpm.actions.SingleCommandProcessor;
+
+/**
+ *
+ * Implementation of a message preprocessor to obtain data from a process instance
+ * from the action configuration XML
+ *
+ * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
+ */
+public class NewProcessInstanceFacade implements SingleCommandProcessor.MessageFacade
+{
+ public OpCode getOpCode()
+ {
+ return (_start)
+ ?Constants.OpCode.StartProcessInstanceCommand
+ :Constants.OpCode.NewProcessInstanceCommand;
+ }
+
+ public NewProcessInstanceFacade(ConfigTree config, boolean start) throws ConfigurationException
+ {
+ _start = start;
+ _actor = config.getAttribute(Constants.ONE_ACTOR_TAG);
+ _processName= config.getAttribute(Constants.PROCESS_DEFINITION_NAME_TAG);
+ String aux = config.getAttribute(Constants.PROCESS_DEFINITION_ID_TAG);
+ if (null!=aux)
+ try {_processId = Long.parseLong(aux); }
+ catch(NumberFormatException e)
+ {
+ throw new ConfigurationException("Invalid value for '"+Constants.PROCESS_DEFINITION_ID_TAG+"'");
+ }
+ _variables = FacadeUtil.variablesFromConfig(config, true);
+
+ if (_start)
+ _transitionName = config.getAttribute(Constants.TRANSITION_NAME_TAG);
+ } // ________________________________
+
+ public void preFormat(Message message)
+ {
+ Body body = message.getBody();
+ if (null!=_actor)
+ body.add(Constants.ACTOR_ID ,_actor);
+ if (null!=_processName)
+ body.add(Constants.PROCESS_DEFINITION_NAME ,_processName);
+ if (null!=_processId)
+ body.add(Constants.PROCESS_DEFINITION_ID ,_processId);
+ if (null!=_variables && _variables.size()>0)
+ body.add(Constants.VARIABLE_VALUES, _variables.jbpmVariables());
+ if (null!=_transitionName)
+ body.add(Constants.TRANSITION_NAME, _transitionName);
+ } // _______________________________
+
+ public Message postFormat(Message response)
+ {
+ return response;
+ } // ________________________________
+
+ boolean _start;
+ String _actor;
+ String _processName;
+ String _transitionName;
+ Long _processId;
+ VariableMapping _variables;
+}
Copied: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/SignalFacade.java (from rev 11309, labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/internal/facades/SignalFacade.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/SignalFacade.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/SignalFacade.java 2007-04-24 18:47:25 UTC (rev 11310)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.services.jbpm.actions.impl.facades;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.jbpm.Constants;
+import org.jboss.soa.esb.services.jbpm.Constants.OpCode;
+import org.jboss.soa.esb.services.jbpm.actions.SingleCommandProcessor;
+import org.jbpm.graph.exe.Token;
+
+/**
+ *
+ * Implementation of a message preprocessor to obtain data from a process instance
+ * from the action configuration XML
+ *
+ * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
+ */
+public class SignalFacade implements SingleCommandProcessor.MessageFacade
+{
+ public OpCode getOpCode() { return Constants.OpCode.SignalCommand; }
+
+ public SignalFacade(ConfigTree config) throws ConfigurationException
+ {
+ _transition = config.getAttribute(Constants.TRANSITION_NAME_TAG);
+ _variables = FacadeUtil.variablesFromConfig(config, false);
+ } // ________________________________
+
+ public void preFormat(Message message)
+ {
+ Body body = message.getBody();
+ if (null!=_transition)
+ body.add(Constants.TRANSITION_NAME, _transition);
+ if (null!=_variables)
+ body.add(Constants.VARIABLE_VALUES, _variables.jbpmVariables());
+ } // _______________________________
+
+ public Message postFormat(Message response)
+ {
+ Body body = response.getBody();
+ Object obj = body.get(Constants.JBPM_RETURN_OBJECT);
+ if (obj instanceof Token)
+ body.add(Constants.CURRENT_NODE_NAME,((Token)obj).getNode().getName());
+ return response;
+ } // ________________________________
+
+ String _transition;
+ VariableMapping _variables;
+}
Copied: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/StartWorkOnTaskFacade.java (from rev 11309, labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/internal/facades/StartWorkOnTaskFacade.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/StartWorkOnTaskFacade.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/StartWorkOnTaskFacade.java 2007-04-24 18:47:25 UTC (rev 11310)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.services.jbpm.actions.impl.facades;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.jbpm.Constants;
+import org.jboss.soa.esb.services.jbpm.Constants.OpCode;
+import org.jboss.soa.esb.services.jbpm.actions.SingleCommandProcessor;
+
+/**
+ *
+ * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
+ */
+public class StartWorkOnTaskFacade implements SingleCommandProcessor.MessageFacade
+{
+ public OpCode getOpCode() { return Constants.OpCode.StartWorkOnTaskCommand; }
+
+ public StartWorkOnTaskFacade(ConfigTree config) throws ConfigurationException
+ {
+ _overwriteSwim = FacadeUtil.booleanFromConfig(config,Constants.OVERWRITE_SWIMLANE_TAG);
+ } // ________________________________
+
+ public void preFormat(Message message)
+ {
+ Body body = message.getBody();
+ if (null!=_overwriteSwim)
+ body.add(Constants.OVERWRITE_SWIMLANE,_overwriteSwim);
+ } // _______________________________
+
+ public Message postFormat(Message response)
+ {
+ return response;
+ } // ________________________________
+
+ Boolean _overwriteSwim;
+}
Copied: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/TaskInstanceEndFacade.java (from rev 11309, labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/internal/facades/TaskInstanceEndFacade.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/TaskInstanceEndFacade.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/TaskInstanceEndFacade.java 2007-04-24 18:47:25 UTC (rev 11310)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.services.jbpm.actions.impl.facades;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.jbpm.Constants;
+import org.jboss.soa.esb.services.jbpm.Constants.OpCode;
+import org.jboss.soa.esb.services.jbpm.actions.SingleCommandProcessor;
+
+/**
+ *
+ * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
+ */
+public class TaskInstanceEndFacade implements SingleCommandProcessor.MessageFacade
+{
+ public OpCode getOpCode() { return Constants.OpCode.TaskInstanceEndCommand; }
+
+ public TaskInstanceEndFacade(ConfigTree config) throws ConfigurationException
+ {
+ _variables = FacadeUtil.variablesFromConfig(config, false);
+ _transitionName = config.getAttribute(Constants.TRANSITION_NAME_TAG);
+ } // ________________________________
+
+ public void preFormat(Message message)
+ {
+ Body body = message.getBody();
+ if (null!=_variables && _variables.size()>0)
+ body.add(Constants.VARIABLE_VALUES, _variables.jbpmVariables());
+ if (null!=_transitionName)
+ body.add(Constants.TRANSITION_NAME, _transitionName);
+ } // _______________________________
+
+ public Message postFormat(Message response)
+ {
+ return response;
+ } // ________________________________
+
+ String _transitionName;
+ VariableMapping _variables;
+}
Copied: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/VariableMapping.java (from rev 11309, labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/internal/facades/VariableMapping.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/VariableMapping.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/VariableMapping.java 2007-04-24 18:47:25 UTC (rev 11310)
@@ -0,0 +1,63 @@
+package org.jboss.soa.esb.services.jbpm.actions.impl.facades;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.soa.esb.util.Util;
+
+/**
+ * A container for variable names and values with access both by esb name and jbpm name.
+ *
+ * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
+ *
+ */
+public class VariableMapping
+{
+ // internal key is always esb name
+ private Map<String,Object> _values = new HashMap<String, Object>();
+ // map jbpm names to esb names
+ private Map<String,String> _jbpmNames = new HashMap<String, String>();
+ // map esb names to jbpm names
+ private Map<String,String> _esbNames = new HashMap<String, String>();
+
+ public int size() { return _values.size(); }
+
+ public String setMapping(String esbName, String jbpmName)
+ {
+ if (Util.isNullString(esbName) && Util.isNullString(jbpmName))
+ throw new IllegalArgumentException("You must specify at least one valid variable name (esb or jBPM)");
+ if (Util.isNullString(jbpmName))
+ jbpmName = esbName;
+ if (Util.isNullString(esbName))
+ esbName = jbpmName;
+ String oldMapping = _esbNames.get(jbpmName);
+ if (null!=oldMapping && !oldMapping.equals(jbpmName))
+ throw new IllegalArgumentException
+ ("Illegal mapping esb=<"+esbName+"> was mapped to jbpm=<"+oldMapping+ "> cannot remap to "+jbpmName);
+
+ _esbNames .put(esbName, jbpmName);
+ _jbpmNames .put(jbpmName, esbName);
+ // Internally, esbName is the key to the variable values
+ return esbName;
+ }
+
+ public void setVariable(String esbName, String jbpmName, Object value)
+ {
+ _values .put(setMapping(esbName, jbpmName), value);
+ }
+
+ public String getEsbName (String key) { return _jbpmNames.get(key); }
+ public String getJbpmName (String key) { return _esbNames.get(key); }
+
+ public Object getEsbVariable (String key) { return _values.get(key); }
+ public Object getJbpmVariable(String key) { return _values.get(_jbpmNames.get(key)); }
+
+ public Map<String,Object> esbVariables() { return _values; }
+ public Map<String,Object> jbpmVariables()
+ {
+ HashMap<String,Object> map = new HashMap<String, Object>();
+ for (Map.Entry<String, Object> curr: _values.entrySet())
+ map.put(getJbpmName(curr.getKey()), curr.getValue());
+ return map;
+ }
+}
Copied: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/VariablesFacade.java (from rev 11309, labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/internal/facades/VariablesFacade.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/VariablesFacade.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/impl/facades/VariablesFacade.java 2007-04-24 18:47:25 UTC (rev 11310)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.services.jbpm.actions.impl.facades;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.jbpm.Constants;
+import org.jboss.soa.esb.services.jbpm.Constants.OpCode;
+import org.jboss.soa.esb.services.jbpm.actions.SingleCommandProcessor;
+
+/**
+ *
+ * Implementation of a message preprocessor to obtain data from a process instance
+ * from the action configuration XML
+ *
+ * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
+ */
+public class VariablesFacade implements SingleCommandProcessor.MessageFacade
+{
+ public OpCode getOpCode() { return Constants.OpCode.VariablesCommand; }
+
+ public VariablesFacade(ConfigTree config) throws ConfigurationException
+ {
+ _variables = FacadeUtil.variablesFromConfig(config, false);
+ } // ________________________________
+
+ public void preFormat(Message message)
+ {
+ Body body = message.getBody();
+ if (null!=_variables && _variables.size()>0)
+ body.add(Constants.VARIABLE_VALUES, _variables.jbpmVariables());
+ } // _______________________________
+
+ public Message postFormat(Message response)
+ {
+ return response;
+ } // ________________________________
+
+ VariableMapping _variables;
+}
Modified: labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/CommandInterpreterUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/CommandInterpreterUnitTest.java 2007-04-24 18:32:27 UTC (rev 11309)
+++ labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/CommandInterpreterUnitTest.java 2007-04-24 18:47:25 UTC (rev 11310)
@@ -64,7 +64,6 @@
_logger.info("@BeforeClass invoked");
try
{
- CommandInterpreter.getJbpmConfig().createSchema();
}
catch (Exception e)
{
Modified: labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/EsbActionHandlerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/EsbActionHandlerUnitTest.java 2007-04-24 18:32:27 UTC (rev 11309)
+++ labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/EsbActionHandlerUnitTest.java 2007-04-24 18:47:25 UTC (rev 11310)
@@ -78,7 +78,6 @@
_logger.info("@BeforeClass invoked");
try
{
- CommandInterpreter.getJbpmConfig().createSchema();
}
catch (Exception e)
{
Modified: labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/SingleCommandProcessorUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/SingleCommandProcessorUnitTest.java 2007-04-24 18:32:27 UTC (rev 11309)
+++ labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/SingleCommandProcessorUnitTest.java 2007-04-24 18:47:25 UTC (rev 11310)
@@ -65,7 +65,6 @@
_logger.info("@BeforeClass invoked");
try
{
- CommandInterpreter.getJbpmConfig().createSchema();
}
catch (Exception e)
{
More information about the jboss-svn-commits
mailing list