[jbpm-commits] JBoss JBPM SVN: r4976 - in projects/jbpm-esb-integration: doc and 8 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Jun 2 07:41:04 EDT 2009
Author: tom.baeyens at jboss.com
Date: 2009-06-02 07:41:04 -0400 (Tue, 02 Jun 2009)
New Revision: 4976
Added:
projects/jbpm-esb-integration/.classpath
projects/jbpm-esb-integration/.project
projects/jbpm-esb-integration/doc/
projects/jbpm-esb-integration/doc/esb.docbook.section.xml
projects/jbpm-esb-integration/doc/esb.xsd.snippets.xml
projects/jbpm-esb-integration/pom.snippets.xml
projects/jbpm-esb-integration/src/
projects/jbpm-esb-integration/src/main/
projects/jbpm-esb-integration/src/main/java/
projects/jbpm-esb-integration/src/main/java/org/
projects/jbpm-esb-integration/src/main/java/org/jbpm/
projects/jbpm-esb-integration/src/main/java/org/jbpm/examples/
projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/
projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/
projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/
projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbActivity.java
projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java
Log:
create jbpm-esb-integration into jbpm projects
Added: projects/jbpm-esb-integration/.classpath
===================================================================
--- projects/jbpm-esb-integration/.classpath (rev 0)
+++ projects/jbpm-esb-integration/.classpath 2009-06-02 11:41:04 UTC (rev 4976)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Property changes on: projects/jbpm-esb-integration/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: projects/jbpm-esb-integration/.project
===================================================================
--- projects/jbpm-esb-integration/.project (rev 0)
+++ projects/jbpm-esb-integration/.project 2009-06-02 11:41:04 UTC (rev 4976)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jbpm-esb-integration</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: projects/jbpm-esb-integration/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: projects/jbpm-esb-integration/doc/esb.docbook.section.xml
===================================================================
--- projects/jbpm-esb-integration/doc/esb.docbook.section.xml (rev 0)
+++ projects/jbpm-esb-integration/doc/esb.docbook.section.xml 2009-06-02 11:41:04 UTC (rev 4976)
@@ -0,0 +1,91 @@
+
+ <!-- ### ESB ########################################################### -->
+ <section id="esb">
+ <title><literal>esb</literal></title>
+ <para>An <literal>esb</literal> activity sends a message to a service over the ESB.
+ The attributes <literal>category</literal> and <literal>service</literal> identify the
+ service in the esb repository. The message is composed with the
+ <literal>part</literal> elements.
+ </para>
+ <table><title><literal>esb</literal> attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>category</literal></entry>
+ <entry>string</entry>
+ <entry></entry>
+ <entry><emphasis role="bold">required</emphasis></entry>
+ <entry>the esb category where the service is defined.</entry>
+ </row>
+ <row>
+ <entry><literal>service</literal></entry>
+ <entry>string</entry>
+ <entry></entry>
+ <entry><emphasis role="bold">required</emphasis></entry>
+ <entry>the esb name of the service
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table><title><literal>esb</literal> elements:</title>
+ <tgroup cols="3" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Element</entry>
+ <entry>Multiplicity</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>part</literal></entry>
+ <entry>0..*</entry>
+ <entry>Parts of the message to be sent.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>For example</para>
+ <figure id="process.esb">
+ <title>The esb example process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.esb.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting><process name="Esb" xmlns="http://jbpm.org/4.0/jpdl">
+
+ <start >
+ <transition to="invoke esb service" />
+ </start>
+
+ <emphasis role="bold"><esb name="invoke esb service"
+ category="orderProcessing"
+ service="bookSold">
+
+ <part name="bookTitle" expr="#{title}" />
+ <part name="goal">
+ <string value="deliver asap" />
+ </part></emphasis>
+
+ <transition to="wait" />
+ <emphasis role="bold"></esb></emphasis>
+
+ <state name="wait" />
+
+</process></programlisting>
+ <para>When a new process is started, a message will be sent to the esb
+ service <literal>bookSold</literal> in category <literal>orderProcessing</literal>.
+ The message will have 2 parts: one named <literal>bookTitle</literal> containing
+ the title process variable. And one named <literal>goal</literal> which
+ contains the text 'deliver asap'.
+ </para>
+ </section>
+
Property changes on: projects/jbpm-esb-integration/doc/esb.docbook.section.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: projects/jbpm-esb-integration/doc/esb.xsd.snippets.xml
===================================================================
--- projects/jbpm-esb-integration/doc/esb.xsd.snippets.xml (rev 0)
+++ projects/jbpm-esb-integration/doc/esb.xsd.snippets.xml 2009-06-02 11:41:04 UTC (rev 4976)
@@ -0,0 +1,53 @@
+ <!-- ~~~ ESB ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="esb">
+ <annotation><documentation>Invokes a service over the ESB.
+ </documentation></annotation>
+ <complexType>
+ <complexContent>
+ <extension base="tns:esbType">
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+
+ <complexType name="esbType">
+ <sequence>
+ <element name="part" minOccurs="0" maxOccurs="unbounded">
+ <annotation><documentation>The content of this expression element
+ is the script text that will be evaluated. This is mutually
+ exclusive with the expression attribute.</documentation></annotation>
+ <complexType>
+ <choice minOccurs="0">
+ <group ref="tns:wireObjectGroup" />
+ </choice>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the message body part.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="expr" type="string">
+ <annotation><documentation>The script text that will be evaluated and
+ used and the object in this message body part.
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+ </sequence>
+ <attribute name="category" type="string">
+ <annotation><documentation>The category of the service in the esb.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="service" type="string">
+ <annotation><documentation>The name of the service in the esb.
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+
+
+ <element name="esb" type="tns:esbType" />
+
Property changes on: projects/jbpm-esb-integration/doc/esb.xsd.snippets.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: projects/jbpm-esb-integration/pom.snippets.xml
===================================================================
--- projects/jbpm-esb-integration/pom.snippets.xml (rev 0)
+++ projects/jbpm-esb-integration/pom.snippets.xml 2009-06-02 11:41:04 UTC (rev 4976)
@@ -0,0 +1,44 @@
+main project parent pom:
+
+ <jbossesb.version>4.4.0.GA</jbossesb.version>
+
+ <dependency>
+ <groupId>org.jbpm.jbpm4.dependencies.esb</groupId>
+ <artifactId>jbossesb-rosetta</artifactId>
+ <version>${jbossesb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm4.dependencies.esb</groupId>
+ <artifactId>test-util</artifactId>
+ <version>${jbossesb.version}</version>
+ </dependency>
+
+from examples pom:
+
+ <dependency>
+ <groupId>org.jbpm.jbpm4.dependencies.esb</groupId>
+ <artifactId>jbossesb-rosetta</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm4.dependencies.esb</groupId>
+ <artifactId>test-util</artifactId>
+ </dependency>
+
+
+from jpdl pom:
+
+ <dependency>
+ <groupId>org.jbpm.jbpm4.dependencies.esb</groupId>
+ <artifactId>jbossesb-rosetta</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>provided</scope>
+ </dependency>
Property changes on: projects/jbpm-esb-integration/pom.snippets.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbActivity.java
===================================================================
--- projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbActivity.java (rev 0)
+++ projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbActivity.java 2009-06-02 11:41:04 UTC (rev 4976)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbpm.jpdl.internal.activity;
+
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.model.ExpressionEvaluator;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EsbActivity extends JpdlAutomaticActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ private static Log log = Log.getLog(EsbActivity.class.getName());
+
+ protected String category = null;
+ protected String service = null;
+ protected ListDescriptor partsListDescriptor = null;
+
+ public void perform(OpenExecution execution) throws Exception {
+ Message message = MessageFactory.getInstance().getMessage();
+ Body body = message.getBody();
+
+ if (partsListDescriptor!=null) {
+ WireContext wireContext = new WireContext();
+ for (Descriptor descriptor: partsListDescriptor.getValueDescriptors()) {
+ String name = descriptor.getName();
+
+ Object object = wireContext.create(descriptor, true);
+ if (object instanceof ExpressionEvaluator) {
+ ExpressionEvaluator expressionEvaluator = (ExpressionEvaluator) object;
+ object = expressionEvaluator.evaluateExpression(execution);
+ }
+ body.add(name, object);
+ }
+ }
+
+ ServiceInvoker invoker = new ServiceInvoker(category, service);
+ log.debug("sending "+message.getBody()+" to service "+service+" in category "+category+" over the esb");
+ invoker.deliverAsync(message);
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+ public void setService(String service) {
+ this.service = service;
+ }
+ public void setPartsListDescriptor(ListDescriptor partsListDescriptor) {
+ this.partsListDescriptor = partsListDescriptor;
+ }
+}
Property changes on: projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java
===================================================================
--- projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java (rev 0)
+++ projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java 2009-06-02 11:41:04 UTC (rev 4976)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbpm.jpdl.internal.activity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ExpressionEvaluatorDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EsbBinding extends JpdlBinding {
+
+ public static final String TAG = "esb";
+ private static final WireParser wireParser = WireParser.getInstance();
+
+ public EsbBinding() {
+ super(TAG);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ EsbActivity esbActivity = new EsbActivity();
+
+ String category = XmlUtil.attribute(element, "category", true, parse);
+ esbActivity.setCategory(category);
+
+ String service = XmlUtil.attribute(element, "service", true, parse);
+ esbActivity.setService(service);
+
+ List<Descriptor> partDescriptors = new ArrayList<Descriptor>();
+ List<Element> partElements = XmlUtil.elements(element, "part");
+ for (Element partElement: partElements) {
+ String name = XmlUtil.attribute(partElement, "name", true, parse);
+ AbstractDescriptor partDescriptor = getPartDescriptor(partElement, parse);
+ partDescriptor.setName(name);
+ partDescriptors.add(partDescriptor);
+ }
+ ListDescriptor partsListDescriptor = new ListDescriptor();
+ if (!partDescriptors.isEmpty()) {
+ partsListDescriptor.setValueDescriptors(partDescriptors);
+ }
+ esbActivity.setPartsListDescriptor(partsListDescriptor);
+
+ return esbActivity;
+ }
+
+ public AbstractDescriptor getPartDescriptor(Element partElement, Parse parse) {
+ String expression = XmlUtil.attribute(partElement, "expr");
+ Element descriptorElement = XmlUtil.element(partElement);
+
+ if ( ( (expression==null) && (descriptorElement==null) )
+ ||
+ ( (expression!=null) && (descriptorElement!=null) )
+ ) {
+ parse.addProblem("in <"+TAG+"...> an expr or exactly one child element is expected");
+ }
+
+ if (expression!=null) {
+ return new ExpressionEvaluatorDescriptor(expression, null);
+ }
+
+ AbstractDescriptor descriptor = (AbstractDescriptor) wireParser.parseElement(descriptorElement, parse, WireParser.CATEGORY_DESCRIPTOR);
+ return descriptor;
+ }
+
+}
Property changes on: projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the jbpm-commits
mailing list