[jboss-svn-commits] JBL Code SVN: r25321 - in labs/jbossesb/branches/JBESB_4_4_GA_FP/product: services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Feb 18 07:19:00 EST 2009


Author: tfennelly
Date: 2009-02-18 07:19:00 -0500 (Wed, 18 Feb 2009)
New Revision: 25321

Added:
   labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbQueryMessage.java
   labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbStartMessage.java
   labs/jbossesb/branches/JBESB_4_4_GA_FP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/GetProcessVariablesFacade.java
   labs/jbossesb/branches/JBESB_4_4_GA_FP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/HungryVariablesCommand.java
Log:
https://jira.jboss.org/jira/browse/JBESB-2418

Added: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbQueryMessage.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbQueryMessage.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbQueryMessage.java	2009-02-18 12:19:00 UTC (rev 25321)
@@ -0,0 +1,50 @@
+/*
+ * 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.samples.quickstarts.bpm_orchestration4.test;
+
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.services.jbpm.Constants;
+import org.jboss.soa.esb.services.jbpm.cmd.MessageHelper;
+import org.jboss.soa.esb.store.Customer;
+
+public class SendEsbQueryMessage {
+
+    public static void main(String args[]) throws Exception {
+        if (args[0].trim().equals("")) {
+            return;
+        }
+
+        System.setProperty("javax.xml.registry.ConnectionFactoryClass", "org.apache.ws.scout.registry.ConnectionFactoryImpl");
+        Message esbMessage = MessageFactory.getInstance().getMessage();
+
+        long processInstanceId = Long.parseLong(args[0]);
+        MessageHelper.setLongValue(esbMessage, Constants.PROCESS_INSTANCE_ID, processInstanceId);
+
+        Message response = (new ServiceInvoker("BPM_orchestration4_Starter_Service", "Get_Service_Vars_Sync")).deliverSync(esbMessage, 10000);
+
+        Customer customer = (Customer) response.getBody().get("customer");
+        System.out.println("'customer' variable as queried from jBPM process: " + customer);
+    }
+}
\ No newline at end of file


Property changes on: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbQueryMessage.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbStartMessage.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbStartMessage.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbStartMessage.java	2009-02-18 12:19:00 UTC (rev 25321)
@@ -0,0 +1,50 @@
+/*
+ * 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.samples.quickstarts.bpm_orchestration4.test;
+
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.util.FileUtil;
+import org.jboss.soa.esb.services.jbpm.cmd.MessageHelper;
+import org.jboss.soa.esb.services.jbpm.Constants;
+
+import java.io.File;
+
+public class SendEsbStartMessage 
+{
+    public static void main(String args[]) throws Exception
+    {
+        System.setProperty("javax.xml.registry.ConnectionFactoryClass","org.apache.ws.scout.registry.ConnectionFactoryImpl");
+
+    	Message esbMessage = MessageFactory.getInstance().getMessage();
+        String orderPayload = FileUtil.readTextFile(new File(args[0]));
+
+    	esbMessage.getBody().add(orderPayload);
+
+        Message response = (new ServiceInvoker("BPM_orchestration4_Starter_Service", "Starter_Service_Sync")).deliverSync(esbMessage, 10000);
+
+        System.out.println("\n\n****** New Process Instance ID: " + MessageHelper.getLongValue(response, Constants.PROCESS_INSTANCE_ID));
+    }
+    
+}


Property changes on: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbStartMessage.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/GetProcessVariablesFacade.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/GetProcessVariablesFacade.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_4_GA_FP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/GetProcessVariablesFacade.java	2009-02-18 12:19:00 UTC (rev 25321)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.soa.esb.services.jbpm.cmd;
+
+import org.jboss.soa.esb.services.jbpm.Constants;
+import org.jboss.soa.esb.services.jbpm.Mapping;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.ConfigurationException;
+
+import java.util.List;
+
+/**
+ * Get process variable facade.
+ * 
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class GetProcessVariablesFacade  extends MessageFacade {
+
+    private List<Mapping> mappings;
+
+    public GetProcessVariablesFacade(ConfigTree configTree) throws ConfigurationException {
+        mappings = ConfigUtil.getMappingConfig(configTree);
+    }
+
+    public Constants.OpCode getOpCode() {
+        return Constants.OpCode.GetProcessInstanceVariablesCommand;
+    }
+
+    public void setJBPMContextParameters(Message message) {
+        message.getBody().add(Constants.BPM_TO_ESB_VARS_TAG, mappings);
+    }
+
+    public static List<Mapping> getMappings(Message message) {
+        return (List<Mapping>) message.getBody().get(Constants.BPM_TO_ESB_VARS_TAG);
+    }
+}


Property changes on: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/GetProcessVariablesFacade.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/HungryVariablesCommand.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/HungryVariablesCommand.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_4_GA_FP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/HungryVariablesCommand.java	2009-02-18 12:19:00 UTC (rev 25321)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.soa.esb.services.jbpm.cmd;
+
+import org.jbpm.command.VariablesCommand;
+import org.jbpm.JbpmContext;
+import org.jbpm.context.exe.VariableContainer;
+
+/**
+ * Get the process variables {@link java.util.Map}.
+ * <p/>
+ * This version of {@link VariablesCommand} "hungrily" gets the process
+ * variable, while still inside the jBPM execution context.
+ * <p/>
+ * {@link VariablesCommand} just returns a lazy proxy that gets the variables lazily.
+ * Gets from this proxy fail outside the context of a jBPM execution context. 
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class HungryVariablesCommand extends VariablesCommand {
+
+    public Object execute(JbpmContext jbpmContext) throws Exception {
+        VariableContainer variableContainer = getVariableContainer(jbpmContext);
+        return variableContainer.getVariables();
+    }
+}


Property changes on: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/HungryVariablesCommand.java
___________________________________________________________________
Name: svn:eol-style
   + native




More information about the jboss-svn-commits mailing list