[jboss-svn-commits] JBL Code SVN: r10850 - in labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb: jbpm and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Apr 10 10:44:32 EDT 2007
Author: kurt.stam at jboss.com
Date: 2007-04-10 10:44:32 -0400 (Tue, 10 Apr 2007)
New Revision: 10850
Added:
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/jbpm/
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/jbpm/util/
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/jbpm/util/CommandVehicle.java
Log:
adding
Copied: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/jbpm/util/CommandVehicle.java (from rev 10848, labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/jbpm/CommandVehicle.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/jbpm/util/CommandVehicle.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/jbpm/util/CommandVehicle.java 2007-04-10 14:44:32 UTC (rev 10850)
@@ -0,0 +1,137 @@
+/*
+ * 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.util;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.util.AbstractCommandVehicle;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.jpdl.JpdlException;
+
+/**
+ *
+ * Base class to use when a jBPM command should go through the wire to a jBPM aware ESB action class.
+ *
+ * <p/>When more commands are added to the 'Command' enumeration, corresponding action class
+ * (org.jboss.soa.esb.actions.JbpmCommandInterpreter) should be modified accordingly in order to
+ * execute new commands
+ *
+ * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
+ *
+ */
+public class CommandVehicle extends AbstractCommandVehicle
+{
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String getCommandValuesTag() { return "jBPMCommandValues"; }
+ @Override
+ public String getCommandOpcodeKey() { return "jBPMOpCode";}
+
+ public static final String PROCESS_DEFINITION ="processDefinition";
+ public static final String PROCESS_DEFINITION_NAME ="processDefName";
+ public static final String PROCESS_DEFINITION_VERSION ="processDefVersion";
+ public static final String PROCESS_INSTANCE_ID ="instanceId";
+ public static final String TOKEN_ID ="tokenId";
+ public static final String TRANSITION_NAME ="transitionName";
+ public static final String CURRENT_NODE_NAME ="currentNodeName";
+ public static final String VARIABLE_NAMES_LIST ="variableNamesList";
+ public static final String VARIABLE_VALUES ="variableValuesMap";
+ public static final String USER_OBJECT ="userObject";
+ public static final String EXCEPTION ="jbpmException";
+ public static final String ERROR_MESSAGE ="errorMsg";
+
+ public static final String RETURN_CODE ="returnCode";
+
+ public static final String RETCODE_OK ="OK";
+ public static final String RETCODE_INVALID_OPCODE ="invalidOpCode";
+ public static final String RETCODE_EXCEPTION ="exceptionThrown";
+ public static final String RETCODE_ERROR ="error";
+
+
+ public static enum Operation
+ {
+ // Operations that the CommandInterpreter can perform
+ deployProcessDefinition
+ ,newProcessInstance
+ ,signalProcess
+ ,signalToken
+ ,getProcessInstanceVariables
+ ,setProcessInstanceVariables
+ ,getTokenVariables
+ ,setTokenVariables
+ ,hasInstanceEnded
+
+ // Operations originated in jBPM ActionHandlers
+ ,responseToRequest
+ ,sendMessageToEsb
+ }
+ @Override
+ public Operation operatorFromString(String value) {return Operation.valueOf(value); }
+
+ public CommandVehicle(Enum command) { super(command); }
+ public CommandVehicle(Message message){ super(message); }
+
+ public Object getReturnCode () { return _values.get(RETURN_CODE); }
+ public ProcessDefinition getProcessDefinition() { return (ProcessDefinition)_values.get(PROCESS_DEFINITION); }
+ public String getProcessDefinitionName () { return (String) _values.get(PROCESS_DEFINITION_NAME); }
+ public int getProcessVersion () { return (Integer) _values.get(PROCESS_DEFINITION_VERSION); }
+ public long getInstanceId () { return (Long) _values.get(PROCESS_INSTANCE_ID); }
+ public long getTokenId () { return (Long) _values.get(TOKEN_ID); }
+ public String getTransitionName () { return (String) _values.get(TRANSITION_NAME); }
+ public String getCurrentNodeName() { return (String) _values.get(CURRENT_NODE_NAME); }
+ @SuppressWarnings("unchecked")
+ public Set<String> getVariableNames () { return (Set<String>)_values.get(VARIABLE_NAMES_LIST); }
+ @SuppressWarnings("unchecked")
+ public Map<String,Object>getVariableValues()
+ {
+ return (Map)_values.get(VARIABLE_VALUES);
+ }
+ public Object getUserObject () { return _values.get(USER_OBJECT); }
+ public Exception getException () { return (Exception)_values.get(EXCEPTION); }
+ public String getErrorMessage () { return (String) _values.get(ERROR_MESSAGE); }
+
+ public void setReturnCode (Object obj){ super.setValue(RETURN_CODE ,obj); }
+ public void setProcessDefinition(ProcessDefinition obj)
+ { super.setValue(PROCESS_DEFINITION ,obj); }
+ public void setProcessDefinition(String xmlString) throws JpdlException
+ {
+ super.setValue(PROCESS_DEFINITION ,ProcessDefinition.parseXmlString(xmlString));
+ }
+ public void setProcessDefinitionName(String obj){ super.setValue(PROCESS_DEFINITION_NAME,obj); }
+ public void setProcessVersion (int obj){ super.setValue(PROCESS_DEFINITION_VERSION,obj); }
+ public void setInstanceId (long obj){ super.setValue(PROCESS_INSTANCE_ID ,obj); }
+ public void setTokenId (long obj){ super.setValue(TOKEN_ID ,obj); }
+ public void setTransitionName (String obj){ super.setValue(TRANSITION_NAME ,obj); }
+ public void setCurrentNodeName (String obj){ super.setValue(CURRENT_NODE_NAME ,obj); }
+ public void setVariableNames (Set<String> obj){ super.setValue(VARIABLE_NAMES_LIST,obj); }
+ public void setVariableValues(Map<String,Object>obj)
+ {
+ super.setValue(VARIABLE_VALUES,obj);
+ }
+ public void setUserObject (Object obj) { super.setValue(USER_OBJECT,obj); }
+ public void setException (Exception obj) { super.setValue(EXCEPTION, obj); }
+ public void setErrorMessage (String obj) { super.setValue(ERROR_MESSAGE, obj); }
+
+}
More information about the jboss-svn-commits
mailing list