diff options
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel')
37 files changed, 3254 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/DISCLAIMER b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/DISCLAIMER new file mode 100644 index 0000000000..d68a410903 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/DISCLAIMER @@ -0,0 +1,8 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/LICENSE b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/LICENSE new file mode 100644 index 0000000000..baba9ca048 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/LICENSE @@ -0,0 +1,251 @@ +
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+===============================================================================================================
+
+Apache Tuscany SCA for Java Subcomponents
+=========================================:
+
+The Tuscany SCA for Java release includes a number of subcomponents with
+separate copyright notices and license terms. Your use of the source
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+=================================================================================================================
+
+This module implementation-script temporarily includes one file under the following BSD license:
+
+ Copyright (c) 2006, Sun Microsystems, Inc.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ - Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ - Neither the name of the Sun Microsystems, Inc. nor the names of
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
+
+=================================================================================================================
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/NOTICE b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/NOTICE new file mode 100644 index 0000000000..f6366c5162 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/NOTICE @@ -0,0 +1,17 @@ +${pom.name}
+Copyright (c) 2005 - 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+Unless otherwise indicated, all distribution made available by the Apache Software Foundation
+is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL").
+A copy of the AL is provided with this distribution as the LICENSE file present in the
+root directory, and is also available at http://www.apache.org/licenses/.
+
+This product also includes software under the BSD license
+(see the LICENSE file contained in this distribution), with
+the following copyright:
+
+Copyright (c) 2006, Sun Microsystems, Inc.
+All rights reserved.
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/pom.xml b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/pom.xml new file mode 100644 index 0000000000..643eef0efc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/pom.xml @@ -0,0 +1,454 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-implementation-bpel</artifactId>
+ <name>Apache Tuscany SCA BPEL Implementation Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <!-- ODE Jars -->
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-epr</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-store</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-dao</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-dao</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
+ <version>1.1</version>
+ <type>zip</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-runtime</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-api</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-scheduler-simple</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-utils</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-compiler</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-schemas</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-obj</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-jacob</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-jacob-ap</artifactId>
+ <version>1.1</version>
+ </dependency>
+
+ <!-- ODE Dependencies -->
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jta_1.0.1B_spec</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-kernel</artifactId>
+ <version>1.2-beta</version>
+ <exclusions>
+ <exclusion>
+ <groupId>mx4j</groupId>
+ <artifactId>mx4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xpp3</groupId>
+ <artifactId>xpp3</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xstream</groupId>
+ <artifactId>xstream</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-transaction</artifactId>
+ <version>1.2-beta</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_2.1_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>ognl</groupId>
+ <artifactId>ognl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_3.0_spec</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-connector</artifactId>
+ <version>1.2-beta</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xmlbeans</groupId>
+ <artifactId>xbean</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.1.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>tranql</groupId>
+ <artifactId>tranql-connector</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-all</artifactId>
+ <version>0.9.7-incubating</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-lib</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-kernel</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-kernel-5</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-jdbc</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-jdbc-5</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-persistence-jdbc</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-xmlstore</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.serp</groupId>
+ <artifactId>serp</artifactId>
+ <version>1.12.0</version>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xmlbeans</groupId>
+ <artifactId>xmlbeans</artifactId>
+ <version>2.3.0</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon</artifactId>
+ <version>8.7</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon-dom</artifactId>
+ <version>8.7</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon-xpath</artifactId>
+ <version>8.7</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <useFile>false</useFile>
+ <trimStackTrace>false</trimStackTrace>
+ <skip>true</skip>
+ <!--useSystemClassLoader>true</useSystemClassLoader-->
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
+ <version>1.1</version>
+ <type>zip</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/test-classes/</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+
+ <!-- plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${basedir}/target/wsdl-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin -->
+
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating</version>
+ <executions>
+ <execution>
+ <id>generate-bpel-helloworld</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/helloworld.wsdl</schemaFile>
+ <targetDirectory>${basedir}/target/wsdl2java-source</targetDirectory>
+ <prefix>HelloWorld</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFiles>
+ <wsdlFile>
+ <fileName>${basedir}/src/test/resources/helloworld.wsdl</fileName>
+ </wsdlFile>
+ </wsdlFiles>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELFactory.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELFactory.java new file mode 100644 index 0000000000..2fb422c1b5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELFactory.java @@ -0,0 +1,41 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel;
+
+/**
+ * A factory for the BPEL implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BPELFactory {
+
+ /**
+ * Creates a new BPEL implementation.
+ *
+ * @return
+ */
+ BPELImplementation createBPELImplementation();
+
+ /**
+ * Creates a new BPEL Process Definition
+ * @return
+ */
+ BPELProcessDefinition createBPELProcessDefinition();
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java new file mode 100644 index 0000000000..422884d98a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java @@ -0,0 +1,54 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.bpel;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * The model representing the BPEL implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BPELImplementation extends Implementation {
+
+ /**
+ * Get the BPEL process Name
+ */
+ QName getProcess();
+
+ /**
+ * Set the BPEL process Name
+ * @param processName process QName
+ */
+ void setProcess(QName processName);
+
+ /**
+ * Get the BPEL process definition
+ * @return
+ */
+ BPELProcessDefinition getProcessDefinition();
+
+ /**
+ * Set the BPEL process definition
+ * @param processDefinition
+ */
+ void setProcessDefinition(BPELProcessDefinition processDefinition);
+}
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.java new file mode 100644 index 0000000000..f52436255a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.implementation.bpel; + +import java.net.URL; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.assembly.Base; + + +/** + * The BPEL process definition. + * + * @version $Rev$ $Date$ + */ +public interface BPELProcessDefinition extends Base { + + /** + * Get the BPEL process Name + */ + public QName getName(); + + /** + * Set the BPEL process Name + * @param processName process QName + */ + public void setName(QName name); + + /** + * Get the URI for the process location + * @return + */ + URL getLocation(); + + /** + * Set the URI for the process location + * @param url + */ + void setLocation(URL location); +} diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELFactory.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELFactory.java new file mode 100644 index 0000000000..a0e9fd9c06 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELFactory.java @@ -0,0 +1,53 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.implementation.bpel.impl.BPELImplementationImpl;
+import org.apache.tuscany.sca.implementation.bpel.impl.BPELProcessDefinitionImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+
+/**
+ * A default factory for the BPEL implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultBPELFactory implements BPELFactory {
+
+ private AssemblyFactory assemblyFactory;
+ private WSDLFactory wsdlFactory;
+
+ public DefaultBPELFactory(ModelFactoryExtensionPoint modelFactories) {
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
+ }
+
+ public BPELImplementation createBPELImplementation() {
+ return new BPELImplementationImpl(assemblyFactory, wsdlFactory);
+ }
+
+ public BPELProcessDefinition createBPELProcessDefinition() {
+ return new BPELProcessDefinitionImpl();
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELDocumentProcessor.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELDocumentProcessor.java new file mode 100644 index 0000000000..352cff0425 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELDocumentProcessor.java @@ -0,0 +1,131 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.implementation.bpel.BPELFactory;
+import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition;
+
+/**
+ * BPEL document processor responsible for reading a BPEL file and producing necessary model info about it
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELDocumentProcessor extends BaseStAXArtifactProcessor implements URLArtifactProcessor<BPELProcessDefinition> {
+ public final static QName BPEL_PROCESS_DEFINITION = new QName("http://schemas.xmlsoap.org/ws/2004/03/business-process/", "process");
+ public final static String NAME_ELEMENT = "name";
+
+ private final static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+
+ private final BPELFactory factory;
+
+ public BPELDocumentProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.factory = modelFactories.getFactory(BPELFactory.class);
+ }
+
+ public String getArtifactType() {
+ return "*.bpel";
+ }
+
+ public Class<BPELProcessDefinition> getModelType() {
+ return BPELProcessDefinition.class;
+ }
+
+ public BPELProcessDefinition read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
+ BPELProcessDefinition processDefinition = null;
+ try {
+ //for now we are just using process name
+ //and relying on componentType file for service definition
+ //so it's ok to set resolved for now
+ processDefinition = indexRead(artifactURL);
+ processDefinition.setUnresolved(false);
+ } catch (Exception e) {
+ throw new ContributionReadException(e);
+ }
+
+ return processDefinition;
+ }
+
+
+ public void resolve(BPELProcessDefinition model, ModelResolver resolver) throws ContributionResolveException {
+ // TODO Auto-generated method stub
+ }
+
+ /**
+ * Read the namespace for the WSDL definition and inline schemas
+ *
+ * @param doc
+ * @return
+ * @throws IOException
+ * @throws XMLStreamException
+ */
+ protected BPELProcessDefinition indexRead(URL doc) throws Exception {
+ BPELProcessDefinition processDefinition = factory.createBPELProcessDefinition();
+ processDefinition.setUnresolved(true);
+ processDefinition.setLocation(doc);
+
+ InputStream is = doc.openStream();
+ XMLStreamReader reader = null;
+ try {
+ reader = inputFactory.createXMLStreamReader(is);
+ int eventType = reader.getEventType();
+ while (true) {
+ if (eventType == XMLStreamConstants.START_ELEMENT) {
+ QName elementName = reader.getName();
+ if (BPEL_PROCESS_DEFINITION.equals(elementName)) {
+ QName processName = new QName(getString(reader, org.apache.tuscany.sca.assembly.xml.Constants.TARGET_NAMESPACE), getString(reader, NAME_ELEMENT));
+ processDefinition.setName(processName);
+ break;
+ }
+ }
+ if (reader.hasNext()) {
+ eventType = reader.next();
+ } else {
+ break;
+ }
+ }
+ } finally {
+ if(reader != null) {
+ reader.close();
+ }
+ is.close();
+ }
+
+ return processDefinition;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java new file mode 100644 index 0000000000..9aab13d6c2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java @@ -0,0 +1,196 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.bpel.impl;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.evt.BpelEvent;
+import org.apache.ode.bpel.iapi.Endpoint;
+import org.apache.ode.bpel.iapi.ProcessConf;
+import org.apache.ode.bpel.iapi.ProcessState;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.impl.ComponentTypeImpl;
+import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
+import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.w3c.dom.Node;
+
+/**
+ * The model representing a BPEL implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELImplementationImpl extends ComponentTypeImpl implements BPELImplementation {
+
+ private QName _processName;
+ private BPELProcessDefinition _processDefinition;
+
+ private boolean unresolved;
+
+ /**
+ * Constructs a new BPEL implementation.
+ */
+ public BPELImplementationImpl(AssemblyFactory assemblyFactory,
+ WSDLFactory wsdlFactory) {
+
+ }
+
+ public QName getProcess() {
+ return _processName;
+ }
+
+ public void setProcess(QName processName) {
+ _processName = processName;
+ }
+
+ public BPELProcessDefinition getProcessDefinition() {
+ return this._processDefinition;
+ }
+
+ public void setProcessDefinition(BPELProcessDefinition processDefinition) {
+ this._processDefinition = processDefinition;
+ }
+
+ @Override
+ public String getURI() {
+ // The sample BPEL implementation does not have a URI
+ return null;
+ }
+
+ @Override
+ public void setURI(String uri) {
+ // The sample BPEL implementation does not have a URI
+ }
+
+ @Override
+ public ConstrainingType getConstrainingType() {
+ // The sample BPEL implementation does not support constrainingTypes
+ return null;
+ }
+
+ @Override
+ public List<Property> getProperties() {
+ // The sample BPEL implementation does not support properties
+ return Collections.emptyList();
+ }
+
+
+ @Override
+ public List<Reference> getReferences() {
+ // The sample BPEL implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public boolean isUnresolved() {
+ return this.unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ private class ProcessConfImpl implements ProcessConf {
+ public QName getProcessId() {
+ return _processName;
+ }
+
+ public QName getType() {
+ return _processName;
+ }
+
+ public long getVersion() {
+ // TODO Versioniong?
+ return 0;
+ }
+
+ public boolean isTransient() {
+ return false;
+ }
+
+ public InputStream getCBPInputStream() {
+ return null; //new ByteArrayInputStream(_compiledProcess);
+ }
+
+ public String getBpelDocument() {
+ return null;
+ }
+
+ public URI getBaseURI() {
+ return null;
+ }
+
+ public Date getDeployDate() {
+ return null;
+ }
+
+ public String getDeployer() {
+ return null;
+ }
+
+ public ProcessState getState() {
+ return null;
+ }
+
+ public List<File> getFiles() {
+ return null;
+ }
+
+ public Map<QName, Node> getProperties() {
+ return null;
+ }
+
+ public String getPackage() {
+ return null;
+ }
+
+ public Definition getDefinitionForService(QName qName) {
+ return null;
+ }
+
+ public Definition getDefinitionForPortType(QName qName) {
+ return null;
+ }
+
+ public Map<String, Endpoint> getProvideEndpoints() {
+ return null;
+ }
+
+ public Map<String, Endpoint> getInvokeEndpoints() {
+ return null;
+ }
+
+ public boolean isEventEnabled(List<String> strings, BpelEvent.TYPE type) {
+ return true;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationProcessor.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationProcessor.java new file mode 100644 index 0000000000..996fa187c1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationProcessor.java @@ -0,0 +1,225 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.bpel.impl;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
+import org.apache.tuscany.sca.implementation.bpel.BPELFactory;
+import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
+import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition;
+import org.apache.tuscany.sca.implementation.bpel.DefaultBPELFactory;
+
+/**
+ * Implements a STAX artifact processor for BPEL implementations.
+ *
+ * The artifact processor is responsible for processing <implementation.bpel>
+ * elements in SCA assembly XML composite files and populating the BPEL
+ * implementation model, resolving its references to other artifacts in the SCA
+ * contribution, and optionally write the model back to SCA assembly XML.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<BPELImplementation> {
+ private static final QName IMPLEMENTATION_BPEL = new QName(Constants.SCA10_NS, "implementation.bpel");
+
+ private AssemblyFactory assemblyFactory;
+ private BPELFactory bpelFactory;
+
+ public BPELImplementationProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.bpelFactory = new DefaultBPELFactory(modelFactories);
+ }
+
+ public QName getArtifactType() {
+ // Returns the qname of the XML element processed by this processor
+ return IMPLEMENTATION_BPEL;
+ }
+
+ public Class<BPELImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return BPELImplementation.class;
+ }
+
+ public BPELImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ assert IMPLEMENTATION_BPEL.equals(reader.getName());
+
+ // Read an <implementation.bpel> element
+
+ // Read the process attribute.
+ QName process = getAttributeValueNS(reader, "process");
+
+
+ // Create an initialize the BPEL implementation model
+ BPELImplementation implementation = bpelFactory.createBPELImplementation();
+ implementation.setProcess(process);
+ //FIXME:lresende
+ //implementation.setCompiledProcess(compiledProcess.toByteArray());
+ implementation.setUnresolved(true);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_BPEL.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return implementation;
+ }
+
+ public void resolve(BPELImplementation impl, ModelResolver resolver) throws ContributionResolveException {
+ if( impl != null && impl.isUnresolved()) {
+ BPELProcessDefinition processDefinition = resolveBPELProcessDefinition(impl, resolver);
+ if(processDefinition.isUnresolved()) {
+ throw new ContributionResolveException("Can't find BPEL Process : " + processDefinition.getName());
+ }
+
+ impl.setProcessDefinition(processDefinition);
+
+ //resolve component type
+ mergeComponentType(resolver, impl);
+
+ //set current implementation resolved
+ impl.setUnresolved(false);
+ }
+
+ }
+
+ public void write(BPELImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException {
+ //FIXME Implement
+ }
+
+ private BPELProcessDefinition resolveBPELProcessDefinition(BPELImplementation impl, ModelResolver resolver) throws ContributionResolveException {
+ QName processName = impl.getProcess();
+ BPELProcessDefinition processDefinition = this.bpelFactory.createBPELProcessDefinition();
+ processDefinition.setName(processName);
+ processDefinition.setUnresolved(true);
+
+ return resolver.resolveModel(BPELProcessDefinition.class, processDefinition);
+ }
+
+
+ /**
+ * Merge the componentType from introspection and external file
+ * @param resolver
+ * @param impl
+ */
+ private void mergeComponentType(ModelResolver resolver, BPELImplementation impl) {
+ // FIXME: Need to clarify how to merge
+ ComponentType componentType = getComponentType(resolver, impl);
+ if (componentType != null && !componentType.isUnresolved()) {
+ /*
+ Map<String, Reference> refMap = new HashMap<String, Reference>();
+ for (Reference ref : impl.getReferences()) {
+ refMap.put(ref.getName(), ref);
+ }
+ for (Reference reference : componentType.getReferences()) {
+ refMap.put(reference.getName(), reference);
+ }
+ impl.getReferences().clear();
+ impl.getReferences().addAll(refMap.values());
+
+ // Try to match references by type
+ Map<String, JavaElementImpl> refMembers = impl.getReferenceMembers();
+ for (Reference ref : impl.getReferences()) {
+ if (ref.getInterfaceContract() != null) {
+ Interface i = ref.getInterfaceContract().getInterface();
+ if (i instanceof JavaInterface) {
+ Class<?> type = ((JavaInterface)i).getJavaClass();
+ if (!refMembers.containsKey(ref.getName())) {
+ JavaElementImpl e = getMemeber(impl, ref.getName(), type);
+ if (e != null) {
+ refMembers.put(ref.getName(), e);
+ }
+ }
+ }
+ }
+ }*/
+
+ Map<String, Service> serviceMap = new HashMap<String, Service>();
+ for (Service svc : impl.getServices()) {
+ if(svc != null) {
+ serviceMap.put(svc.getName(), svc);
+ }
+ }
+ for (Service service : componentType.getServices()) {
+ //set default dataBinding to DOM
+ service.getInterfaceContract().getInterface().setDefaultDataBinding(DOMDataBinding.NAME);
+
+ serviceMap.put(service.getName(), service);
+ }
+ impl.getServices().clear();
+ impl.getServices().addAll(serviceMap.values());
+
+ Map<String, Property> propMap = new HashMap<String, Property>();
+ for (Property prop : impl.getProperties()) {
+ propMap.put(prop.getName(), prop);
+ }
+ }
+ }
+
+
+ private ComponentType getComponentType(ModelResolver resolver, BPELImplementation impl) {
+ String bpelName = impl.getProcess().getLocalPart().toLowerCase();
+ String componentTypeURI = bpelName.replace('.', '/') + ".componentType";
+ ComponentType componentType = assemblyFactory.createComponentType();
+ componentType.setUnresolved(true);
+ componentType.setURI(componentTypeURI);
+ componentType = resolver.resolveModel(ComponentType.class, componentType);
+ if (!componentType.isUnresolved()) {
+ return componentType;
+ }
+ return null;
+ }
+
+ private QName getAttributeValueNS(XMLStreamReader reader, String attribute) {
+ String fullValue = reader.getAttributeValue(null, "process");
+ if (fullValue.indexOf(":") < 0)
+ throw new ODEProcessException("Attribute " + attribute + " with value " + fullValue +
+ " in your composite should be prefixed (process=\"prefix:name\").");
+ String prefix = fullValue.substring(0, fullValue.indexOf(":"));
+ String name = fullValue.substring(fullValue.indexOf(":") + 1);
+ String nsUri = reader.getNamespaceContext().getNamespaceURI(prefix);
+ if (nsUri == null)
+ throw new ODEProcessException("Attribute " + attribute + " with value " + fullValue +
+ " in your composite has un unrecognized namespace prefix.");
+ return new QName(nsUri, name, prefix);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.java new file mode 100644 index 0000000000..15523b54dc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.java @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.implementation.bpel.impl; + +import java.net.URL; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition; + +/** + * The BPEL process definition implementation. + * + * @version $Rev$ $Date$ + */ +public class BPELProcessDefinitionImpl implements BPELProcessDefinition { + private QName name; + private URL location; + private boolean unresolved; + + public QName getName() { + return name; + } + + public void setName(QName name) { + this.name = name; + } + + public URL getLocation() { + return this.location; + } + + public void setLocation(URL location) { + this.location = location; + } + + public boolean isUnresolved() { + return unresolved; + } + + public void setUnresolved(boolean undefined) { + this.unresolved = undefined; + } + + public void compile() { + /* + String bpelFile = reader.getAttributeValue(null, "file"); // FIXME: + + // Resolving the BPEL file and compiling it + URL bpelURL = getClass().getClassLoader().getResource(bpelFile); + if (bpelURL == null) + throw new ODEProcessException("Couldn't find referenced bpel file " + bpelFile); + BpelC bpelc = BpelC.newBpelCompiler(); + ByteArrayOutputStream compiledProcess = new ByteArrayOutputStream(); + bpelc.setOutputStream(compiledProcess); + try { + bpelc.compile(new File(bpelURL.getFile())); + } catch (IOException e) { + e.printStackTrace(); + } + */ + } + + @Override + public int hashCode() { + return String.valueOf(getName()).hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (obj == this) { + return true; + } else if (obj instanceof BPELProcessDefinition) { + if (getName() != null) { + return getName().equals(((BPELProcessDefinition)obj).getName()); + } else { + return ((BPELProcessDefinition)obj).getName() == null; + } + } else { + return false; + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/ODEProcessException.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/ODEProcessException.java new file mode 100644 index 0000000000..017e3d85ef --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/ODEProcessException.java @@ -0,0 +1,42 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel.impl;
+
+/**
+ * Thrown when a process can't be compiled properly or when its descriptors
+ * are invalid.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ODEProcessException extends RuntimeException {
+ private static final long serialVersionUID = 1047893235216756186L;
+
+ public ODEProcessException(String message) {
+ super(message);
+ }
+
+ public ODEProcessException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ODEProcessException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java new file mode 100644 index 0000000000..065edd5a8f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java @@ -0,0 +1,232 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel.ode;
+
+import java.io.File;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Properties;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import javax.transaction.TransactionManager;
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.dao.BpelDAOConnectionFactoryJDBC;
+import org.apache.ode.bpel.engine.BpelServerImpl;
+import org.apache.ode.bpel.engine.CountLRUDehydrationPolicy;
+import org.apache.ode.bpel.iapi.ProcessConf;
+import org.apache.ode.bpel.iapi.ProcessStore;
+import org.apache.ode.bpel.iapi.ProcessStoreEvent;
+import org.apache.ode.bpel.iapi.ProcessStoreListener;
+import org.apache.ode.bpel.iapi.Scheduler;
+import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
+import org.apache.ode.il.config.OdeConfigProperties;
+import org.apache.ode.il.dbutil.Database;
+import org.apache.ode.store.ProcessStoreImpl;
+import org.apache.ode.scheduler.simple.SimpleScheduler;
+import org.apache.ode.scheduler.simple.JdbcDelegate;
+import org.apache.ode.utils.GUID;
+
+/**
+ * Embedded ODE process server
+ *
+ * @version $Rev$ $Date$
+ */
+public class EmbeddedODEServer {
+ protected final Log __log = LogFactory.getLog(getClass());
+
+ private boolean _initialized;
+
+ private OdeConfigProperties _config;
+
+ private TransactionManager _txMgr;
+
+ private Database _db;
+
+ private File _workRoot;
+
+ private BpelDAOConnectionFactoryJDBC _daoCF;
+
+ private BpelServerImpl _bpelServer;
+
+ protected ProcessStore store;
+
+ private ExecutorService _executor;
+
+ private Scheduler _scheduler;
+
+
+ public EmbeddedODEServer(TransactionManager txMgr) {
+ _txMgr = txMgr;
+ }
+
+ public void init() throws ODEInitializationException {
+ _config = new OdeConfigProperties(new Properties(), "ode-sca");
+
+ // Setting work root as the directory containing our database (wherever in the classpath)
+ URL dbLocation = getClass().getClassLoader().getResource("jpadb");
+ if (dbLocation == null)
+ throw new ODEInitializationException("Couldn't find database in the classpath");
+ _workRoot = new File(dbLocation.getFile()).getParentFile();
+
+ initTxMgr();
+ initPersistence();
+ initBpelServer();
+
+ try {
+ _bpelServer.start();
+ } catch (Exception ex) {
+ String errmsg = "An error occured during the ODE BPEL server startup.";
+ __log.error(errmsg, ex);
+ throw new ODEInitializationException(errmsg, ex);
+ }
+
+ __log.info("ODE BPEL server started.");
+ _initialized = true;
+ }
+
+ private void initTxMgr() {
+ if(_txMgr == null) {
+ try {
+ GeronimoTxFactory txFactory = new GeronimoTxFactory();
+ _txMgr = txFactory.getTransactionManager();
+ } catch (Exception e) {
+ __log.fatal("Couldn't initialize a transaction manager using Geronimo's transaction factory.", e);
+ throw new ODEInitializationException("Couldn't initialize a transaction manager using " + "Geronimo's transaction factory.", e);
+ }
+ }
+ }
+
+ private void initPersistence() {
+ _db = new Database(_config);
+ _db.setTransactionManager(_txMgr);
+ _db.setWorkRoot(_workRoot);
+
+ try {
+ _db.start();
+ _daoCF = _db.createDaoCF();
+ } catch (Exception ex) {
+ String errmsg = "Error while configuring ODE persistence.";
+ __log.error(errmsg, ex);
+ throw new ODEInitializationException(errmsg, ex);
+ }
+ }
+
+ private void initBpelServer() {
+ if (__log.isDebugEnabled()) {
+ __log.debug("ODE initializing");
+ }
+ if (_config.getThreadPoolMaxSize() == 0)
+ _executor = Executors.newCachedThreadPool();
+ else
+ _executor = Executors.newFixedThreadPool(_config.getThreadPoolMaxSize());
+
+ _bpelServer = new BpelServerImpl();
+ _scheduler = createScheduler();
+ _scheduler.setJobProcessor(_bpelServer);
+
+ _bpelServer.setDaoConnectionFactory(_daoCF);
+ _bpelServer.setInMemDaoConnectionFactory(new BpelDAOConnectionFactoryImpl(_scheduler));
+ // _bpelServer.setEndpointReferenceContext(new EndpointReferenceContextImpl(this));
+ _bpelServer.setMessageExchangeContext(new ODEMessageExchangeContext(this));
+ _bpelServer.setBindingContext(new ODEBindingContext(this));
+ _bpelServer.setScheduler(_scheduler);
+ if (_config.isDehydrationEnabled()) {
+ CountLRUDehydrationPolicy dehy = new CountLRUDehydrationPolicy();
+ _bpelServer.setDehydrationPolicy(dehy);
+ }
+
+ store = new ProcessStoreImpl(_db.getDataSource(), "jpa", true);
+ store.registerListener(new ProcessStoreListener() {
+ public void onProcessStoreEvent(ProcessStoreEvent event) {
+ // bounce the process
+ _bpelServer.unregister(event.pid);
+ if (event.type != ProcessStoreEvent.Type.UNDEPLOYED) {
+ ProcessConf conf = (ProcessConf) store.getProcessConfiguration(event.pid);
+ // Test processes always run with in-mem DAOs
+ // conf.setTransient(true); //FIXME: what should we use for ProcessConfImpl
+ _bpelServer.register(conf);
+ }
+ }
+ });
+
+ _bpelServer.init();
+ }
+
+ public void stop() throws ODEShutdownException {
+ try {
+ _bpelServer.stop();
+ } catch (Exception ex) {
+ String errmsg = "An error occured during the ODE BPEL server shutdown.";
+ __log.error(errmsg, ex);
+ throw new ODEInitializationException(errmsg, ex);
+ }
+ }
+
+ protected Scheduler createScheduler() {
+ SimpleScheduler scheduler = new SimpleScheduler(new GUID().toString(),new JdbcDelegate(_db.getDataSource()));
+ scheduler.setTransactionManager(_txMgr);
+
+ return scheduler;
+ }
+
+ public boolean isInitialized() {
+ return _initialized;
+ }
+
+ public BpelServerImpl getBpelServer() {
+ return _bpelServer;
+ }
+
+ public Scheduler getScheduler() {
+ return _scheduler;
+ }
+
+ public void deploy(ODEDeployment d) {
+ Collection<QName> procs;
+
+ try {
+ procs = store.deploy(d.deployDir);
+
+ // _deployed.add(d);
+ } catch (Exception ex) {
+ System.out.println(d + "DEPLOY: Unexpected exception: " + ex.getMessage());
+ return;
+ }
+
+ try {
+ for (QName procName : procs) {
+ ProcessConf conf = (ProcessConf) store.getProcessConfiguration(procName);
+ // Test processes always run with in-mem DAOs
+ //conf.setTransient(true); //FIXME: what should we use for ProcessConfImpl
+ _bpelServer.register(conf);
+ }
+ } catch (Exception ex) {
+ System.out.println(d + "REGISTER: Unexpected exception: " + ex.getMessage());
+ }
+ }
+
+ public void undeploy(ODEDeployment d) {
+ //TODO
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java new file mode 100644 index 0000000000..079f9627f5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java @@ -0,0 +1,48 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel.ode;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.transaction.TransactionManager;
+
+/**
+ * Geronimo transaction factory
+ *
+ * @version $Rev$ $Date$
+ */
+public class GeronimoTxFactory {
+ private static final Log __log = LogFactory.getLog(GeronimoTxFactory.class);
+
+ /* Public no-arg contructor is required */
+ public GeronimoTxFactory() {
+ }
+
+ public TransactionManager getTransactionManager() {
+ __log.info("Using embedded Geronimo transaction manager");
+ try {
+ Object obj = new org.apache.geronimo.transaction.manager.GeronimoTransactionManager();
+ return (TransactionManager) obj;
+ } catch (Exception except) {
+ throw new IllegalStateException("Unable to instantiate Geronimo Transaction Manager", except);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java new file mode 100644 index 0000000000..bb7d1b13a8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.implementation.bpel.ode; + +import org.apache.ode.bpel.iapi.BindingContext; +import org.apache.ode.bpel.iapi.EndpointReference; +import org.apache.ode.bpel.iapi.Endpoint; +import org.apache.ode.bpel.iapi.PartnerRoleChannel; +import org.w3c.dom.Document; + +import javax.xml.namespace.QName; +import javax.wsdl.PortType; + +/** + * @author Matthieu Riou <mriou@apache.org> + */ +public class ODEBindingContext implements BindingContext { + + private EmbeddedODEServer _server; + + public ODEBindingContext(EmbeddedODEServer _server) { + this._server = _server; + } + + public EndpointReference activateMyRoleEndpoint(QName pid, Endpoint endpoint) { + return new TuscanyEPR(); + } + + public void deactivateMyRoleEndpoint(Endpoint endpoint) { + // TODO + } + + public PartnerRoleChannel createPartnerRoleChannel(QName qName, PortType portType, Endpoint endpoint) { + // TODO + return null; + } + + // TODO This should hold something that makes sense for Tuscany so that the process has + // an address that makes sense from the outside world perspective + private class TuscanyEPR implements EndpointReference { + public Document toXML() { + return null; + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java new file mode 100644 index 0000000000..2677f38c88 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.implementation.bpel.ode; + +import java.io.File; + +/** + * Deployment information + * + * @version $Rev$ $Date$ + */ +public class ODEDeployment { + /** The directory containing the deploy.xml and artefacts. */ + public File deployDir; + + /** If non-null the type of exception we expect to get when we deploy. */ + public Class expectedException = null; + + public ODEDeployment(File deployDir) { + this.deployDir = deployDir; + } + + public String toString() { + return "Deployment#" + deployDir; + } +}
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java new file mode 100644 index 0000000000..3241dce387 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java @@ -0,0 +1,41 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel.ode;
+
+/**
+ * Thrown when ODE failed to initialize one if its needed resources.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ODEInitializationException extends RuntimeException {
+ private static final long serialVersionUID = -2869674556330744215L;
+
+ public ODEInitializationException(Throwable cause) {
+ super(cause);
+ }
+
+ public ODEInitializationException(String message) {
+ super(message);
+ }
+
+ public ODEInitializationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java new file mode 100644 index 0000000000..163ad5c66f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +package org.apache.tuscany.sca.implementation.bpel.ode; + +import org.apache.ode.bpel.iapi.*; +import org.apache.ode.utils.DOMUtils; + +/** + * @author Matthieu Riou <mriou@apache.org> + */ +public class ODEMessageExchangeContext implements MessageExchangeContext { + private EmbeddedODEServer _server; + + public ODEMessageExchangeContext(EmbeddedODEServer _server) { + this._server = _server; + } + + public void invokePartner(PartnerRoleMessageExchange partnerRoleMessageExchange) throws ContextException { + // TODO necessary to invoke an external service + } + + public void onAsyncReply(MyRoleMessageExchange myRoleMessageExchange) throws BpelEngineException { + // TODO necessary to get the reply when is returned asynchronously (in a different thread) + } +} diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java new file mode 100644 index 0000000000..a928379ba9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.implementation.bpel.ode; + +/** + * Thrown when ODE failed to shutdown. + * + * @version $Rev$ $Date$ + */ +public class ODEShutdownException extends RuntimeException { + private static final long serialVersionUID = -2869674556330744215L; + + public ODEShutdownException(Throwable cause) { + super(cause); + } + + public ODEShutdownException(String message) { + super(message); + } + + public ODEShutdownException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.java new file mode 100644 index 0000000000..12624ac324 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.java @@ -0,0 +1,117 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.bpel.provider;
+
+import java.io.File;
+import java.net.URL;
+
+import javax.transaction.TransactionManager;
+
+import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
+import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
+import org.apache.tuscany.sca.implementation.bpel.ode.ODEDeployment;
+import org.apache.tuscany.sca.implementation.bpel.ode.ODEInitializationException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ * The sample CRUD implementation is not a full blown implementation, it only
+ * supports a subset of what a component implementation can support: - a single
+ * fixed service (as opposed to a list of services typed by different
+ * interfaces) - a directory attribute used to specify where a CRUD component is
+ * going to persist resources - no references or properties - no policy intents
+ * or policy sets
+ */
+public class BPELImplementationProvider implements ImplementationProvider {
+
+ private RuntimeComponent component;
+
+ private EmbeddedODEServer odeServer;
+ private TransactionManager txMgr;
+
+ private BPELImplementation implementation;
+
+ /**
+ * Constructs a new BPEL Implementation.
+ */
+ public BPELImplementationProvider(RuntimeComponent component,
+ BPELImplementation implementation,
+ EmbeddedODEServer odeServer,
+ TransactionManager txMgr) {
+ this.component = component;
+ this.implementation = implementation;
+ this.odeServer = odeServer;
+ this.txMgr = txMgr;
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ BPELInvoker invoker = new BPELInvoker(operation, odeServer, txMgr);
+ return invoker;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ System.out.println("Starting " + component.getName() + " " + component.getClass().getName());
+
+ try {
+ if (!odeServer.isInitialized()) {
+ // start ode server
+ odeServer.init();
+ }
+
+ URL deployURL = this.implementation.getProcessDefinition().getLocation();
+
+ File deploymentDir = new File(deployURL.toURI().getPath()).getParentFile();
+ System.out.println("Deploying : " + deploymentDir.toString());
+ System.out.println(deploymentDir);
+
+ // deploy the process
+ if (odeServer.isInitialized()) {
+ try {
+ txMgr.begin();
+ odeServer.deploy(new ODEDeployment(deploymentDir));
+ txMgr.commit();
+ } catch (Exception e) {
+ e.printStackTrace();
+ txMgr.rollback();
+ }
+ }
+
+ } catch (ODEInitializationException inite) {
+ throw new RuntimeException("BPEL Component Type Implementation : Error initializing embedded ODE server " + inite.getMessage(), inite);
+ } catch(Exception e) {
+ throw new RuntimeException("BPEl Component Type Implementation initialization failure : " + e.getMessage(), e);
+ }
+
+ // FIXME:lresende
+ // odeServer.getBpelServer().register(implementation.getProcessConf());
+ }
+
+ public void stop() {
+ System.out.println("Stopping " + component.getName() + " " + component.getClass().getName());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.java new file mode 100644 index 0000000000..cc485e7ad9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.java @@ -0,0 +1,61 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.bpel.provider;
+
+import javax.transaction.TransactionManager;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
+import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
+import org.apache.tuscany.sca.implementation.bpel.ode.GeronimoTxFactory;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * BPEL Implementation provider factory
+ *
+ * We use the provider factory to instantiate a ODE server that is going to be injected in all BPEL components
+ */
+public class BPELImplementationProviderFactory implements ImplementationProviderFactory<BPELImplementation> {
+
+ private EmbeddedODEServer odeServer;
+ private TransactionManager txMgr;
+
+ /**
+ * Default constructor receiving an extension point
+ * @param extensionPoints
+ */
+ public BPELImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
+ GeronimoTxFactory txFactory = new GeronimoTxFactory();
+ txMgr = txFactory.getTransactionManager();
+ this.odeServer = new EmbeddedODEServer(txMgr);
+ }
+
+ /**
+ * Creates a new BPEL Implementation and inject the EmbeddedODEServer
+ */
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, BPELImplementation implementation) {
+ return new BPELImplementationProvider(component, implementation, odeServer, txMgr);
+ }
+
+ public Class<BPELImplementation> getModelType() {
+ return BPELImplementation.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.java new file mode 100644 index 0000000000..112c7e2f3d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.java @@ -0,0 +1,214 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel.provider;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.concurrent.Future;
+
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+import javax.wsdl.Part;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
+import org.apache.ode.bpel.iapi.MessageExchange.Status;
+import org.apache.ode.utils.DOMUtils;
+import org.apache.ode.utils.GUID;
+import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Implements a target invoker for BPEL component implementations.
+ *
+ * The target invoker is responsible for dispatching invocations to the particular
+ * component implementation logic. In this example we are simply delegating the
+ * CRUD operation invocations to the corresponding methods on our fake
+ * resource manager.
+ */
+public class BPELInvoker implements Invoker {
+ private EmbeddedODEServer odeServer;
+ private TransactionManager txMgr;
+
+ private Operation operation;
+ private QName bpelServiceName;
+ private String bpelOperationName;
+ private Part bpelOperationInputPart;
+ private Part bpelOperationOutputPart;
+
+ public BPELInvoker(Operation operation, EmbeddedODEServer odeServer, TransactionManager txMgr) {
+ this.operation = operation;
+ this.odeServer = odeServer;
+ this.txMgr = txMgr;
+
+ initializeInvocation();
+ }
+
+
+ private void initializeInvocation() {
+
+ this.bpelOperationName = operation.getName();
+
+ Interface interfaze = operation.getInterface();
+ if(interfaze instanceof WSDLInterface){
+ WSDLInterface wsdlInterface = null;
+ wsdlInterface = (WSDLInterface) interfaze;
+
+ Service serviceDefinition = (Service) wsdlInterface.getWsdlDefinition().getDefinition().getServices().values().iterator().next();
+ bpelServiceName = serviceDefinition.getQName();
+
+ bpelOperationInputPart = (Part) wsdlInterface.getPortType().getOperation(bpelOperationName,null,null).getInput().getMessage().getParts().values().iterator().next();
+ bpelOperationOutputPart = (Part) wsdlInterface.getPortType().getOperation(bpelOperationName,null,null).getOutput().getMessage().getParts().values().iterator().next();
+ }
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object[] args = msg.getBody();
+ Object resp = doTheWork(args);
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ }
+ return msg;
+ }
+
+ public Object doTheWork(Object[] args) throws InvocationTargetException {
+ Element response = null;
+
+ if(! (operation.getInterface() instanceof WSDLInterface)) {
+ throw new InvocationTargetException(null,"Unsupported service contract");
+ }
+
+ org.apache.ode.bpel.iapi.MyRoleMessageExchange mex = null;
+ Future onhold = null;
+
+ //Process the BPEL process invocation
+ try {
+ txMgr.begin();
+ mex = odeServer.getBpelServer().getEngine().createMessageExchange(new GUID().toString(),
+ bpelServiceName,
+ bpelOperationName);
+ onhold = mex.invoke(createInvocationMessage(mex, args));
+
+ txMgr.commit();
+ } catch (Exception e) {
+ try {
+ txMgr.rollback();
+ } catch (SystemException se) {
+
+ }
+ throw new InvocationTargetException(e, "Error invoking BPEL process : " + e.getMessage());
+ }
+
+
+ // Waiting until the reply is ready in case the engine needs to continue in a different thread
+ if (onhold != null) {
+ try {
+ onhold.get();
+ } catch (Exception e) {
+ throw new InvocationTargetException(e,"Error invoking BPEL process : " + e.getMessage());
+ }
+ }
+
+ //Process the BPEL invocation response
+ try {
+ txMgr.begin();
+ // Reloading the mex in the current transaction, otherwise we can't
+ // be sure we have the "freshest" one.
+ mex = (MyRoleMessageExchange)odeServer.getBpelServer().getEngine().getMessageExchange(mex.getMessageExchangeId());
+
+ Status status = mex.getStatus();
+ System.out.println("Status: " + status.name());
+ Element invocationResponse = mex.getResponse().getMessage();
+ System.out.println("Response: " + DOMUtils.domToString(invocationResponse));
+
+ //process the method invocation result
+ response = processResponse(invocationResponse);
+
+ txMgr.commit();
+ // end of transaction two
+ } catch (Exception e) {
+ try {
+ txMgr.rollback();
+ } catch (SystemException se) {
+
+ }
+ throw new InvocationTargetException(e, "Error retrieving BPEL process invocation status : " + e
+ .getMessage());
+ }
+
+
+ return response;
+ }
+
+ /**
+ * Create BPEL Invocation message
+ *
+ * BPEL invocation message like :
+ * <message>
+ * <TestPart>
+ * <hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">Hello</hello>
+ * </TestPart>
+ * </message>
+ * @param args
+ * @return
+ */
+ private org.apache.ode.bpel.iapi.Message createInvocationMessage(org.apache.ode.bpel.iapi.MyRoleMessageExchange mex, Object[] args) {
+ Document dom = DOMUtils.newDocument();
+
+ Element contentMessage = dom.createElement("message");
+ Element contentPart = dom.createElement(bpelOperationInputPart.getName());
+ Element contentInvocation = (Element) args[0];
+
+ contentPart.appendChild(dom.importNode(contentInvocation, false));
+ contentMessage.appendChild(contentPart);
+ dom.appendChild(contentMessage);
+
+ System.out.println("::message:: " + DOMUtils.domToString(dom.getDocumentElement()));
+
+ org.apache.ode.bpel.iapi.Message request = mex.createMessage(new QName("", ""));
+ request.setMessage(dom.getDocumentElement());
+
+ return request;
+ }
+
+ /**
+ * Process BPEL response
+ *
+ * <message>
+ * <TestPart>
+ * <hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">World</hello>
+ * </TestPart>
+ * </message>
+ *
+ * @param response
+ * @return
+ */
+ private Element processResponse(Element response) {
+ return (Element) DOMUtils.findChildByName(response, new QName("",bpelOperationOutputPart.getName()));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor new file mode 100644 index 0000000000..4763c69768 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Implementation class for the artifact processor extension +org.apache.tuscany.sca.implementation.bpel.impl.BPELImplementationProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementation.bpel,model=org.apache.tuscany.sca.implementation.bpel.BPELImplementation
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor new file mode 100644 index 0000000000..066fdc864b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.implementation.bpel.impl.BPELDocumentProcessor;type=.bpel,model=org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory new file mode 100644 index 0000000000..53ffd1b72a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.implementation.bpel.DefaultBPELFactory
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory new file mode 100644 index 0000000000..b6481b1512 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the implementation extension
+org.apache.tuscany.sca.implementation.bpel.provider.BPELImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.bpel.BPELImplementation
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java new file mode 100644 index 0000000000..32261375ef --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.implementation.bpel; + +import java.net.URI; +import java.net.URL; + +import javax.xml.namespace.QName; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; +import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint; +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.implementation.bpel.impl.BPELDocumentProcessor; +import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory; + +/** + * @version $Rev$ $Date$ + */ +public class BPELDocumentProcessorTestCase extends TestCase { + + protected static final String BPEL_PROCESS_FILE = "helloworld.bpel"; + + private ModelFactoryExtensionPoint modelFactories; + + @Override + protected void setUp() throws Exception { + super.setUp(); + + modelFactories = new DefaultModelFactoryExtensionPoint(); + modelFactories.addFactory(new DefaultAssemblyFactory()); + modelFactories.addFactory(new DefaultWSDLFactory()); + + BPELFactory bpelFactory = new DefaultBPELFactory(modelFactories); + modelFactories.addFactory(bpelFactory); + } + + public void testLoadBPELProcessDefinition() throws Exception { + BPELDocumentProcessor bpelDocumentProcessor = new BPELDocumentProcessor(modelFactories); + + URI processURI = getClass().getClassLoader().getResource(BPEL_PROCESS_FILE).toURI(); + URL processLocation = getClass().getClassLoader().getResource(BPEL_PROCESS_FILE); + BPELProcessDefinition bpelProcessDefinition = bpelDocumentProcessor.read(null, processURI, processLocation); + + assertNotNull(bpelProcessDefinition); + assertEquals(new QName("http://tuscany.apache.org/implementation/bpel/example/helloworld", "HelloWorld"), bpelProcessDefinition.getName()); + assertEquals(processLocation, bpelProcessDefinition.getLocation()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELHelloWorldTestCase.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELHelloWorldTestCase.java new file mode 100644 index 0000000000..24750ef07a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELHelloWorldTestCase.java @@ -0,0 +1,59 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.bpel;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Tests the BPEL service
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELHelloWorldTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ HelloPortType bpelService = null;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("helloworld.composite");
+ bpelService = scaDomain.getService(HelloPortType.class, "BPELHelloWorldComponent");
+
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testInvoke() {
+ String response = bpelService.hello("Hello");
+ assertEquals("World", response);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java new file mode 100644 index 0000000000..b52a75012f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.implementation.bpel; + +import java.io.StringReader; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamReader; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.assembly.AssemblyFactory; +import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; +import org.apache.tuscany.sca.assembly.xml.Constants; +import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint; +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.implementation.bpel.impl.BPELImplementationProcessor; +import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; + +/** + * @version $Rev$ $Date$ + */ +public class BPELImplementationProcessorTestCase extends TestCase { + + protected static final QName IMPLEMENTATION_BPEL = new QName(Constants.SCA10_NS, "implementation.bpel"); + + private static final String COMPOSITE = + "<?xml version=\"1.0\" encoding=\"ASCII\"?>" + + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:hns=\"http://tuscany.apache.org/implementation/bpel/example/helloworld\" targetNamespace=\"http://bpel\" name=\"bpel\">" + + " <component name=\"BPELHelloWorldComponent\">" + + " <implementation.bpel process=\"hns:HelloWorld\" />" + + "</component>"; + + private static final String COMPOSITE_INVALID = + "<?xml version=\"1.0\" encoding=\"ASCII\"?>" + + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:hns=\"http://tuscany.apache.org/implementation/bpel/example/helloworld\" targetNamespace=\"http://bpel\" name=\"bpel\">" + + " <component name=\"BPELHelloWorldComponent\">" + + " <implementation.bpel/>" + + "</component>"; + + private XMLInputFactory xmlFactory; + private ModelFactoryExtensionPoint modelFactories; + + @Override + protected void setUp() throws Exception { + super.setUp(); + xmlFactory = XMLInputFactory.newInstance(); + + modelFactories = new DefaultModelFactoryExtensionPoint(); + AssemblyFactory assemblyFactory = new DefaultAssemblyFactory(); + modelFactories.addFactory(assemblyFactory); + JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory(); + modelFactories.addFactory(javaFactory); + } + + /** + * Test parsing valid composite definition. Valid coposite populated with correct values expected. + * @throws Exception + */ + public void testLoadValidComposite() throws Exception { + XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(COMPOSITE)); + + BPELImplementationProcessor bpelProcessor = new BPELImplementationProcessor(modelFactories); + + while(true) { + int event = reader.next(); + if(event == XMLStreamConstants.START_ELEMENT && IMPLEMENTATION_BPEL.equals(reader.getName())) { + break; + } + } + + BPELImplementation implementation = bpelProcessor.read(reader); + + assertNotNull(implementation); + assertEquals(new QName("http://tuscany.apache.org/implementation/bpel/example/helloworld", "HelloWorld"), implementation.getProcess()); + } + + /** + * Test parsing invalid composite definition. Exception should be thrown + * @throws Exception + */ + public void testLoadInvalidComposite() throws Exception { + XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(COMPOSITE_INVALID)); + + BPELImplementationProcessor bpelProcessor = new BPELImplementationProcessor(modelFactories); + + while(true) { + int event = reader.next(); + if(event == XMLStreamConstants.START_ELEMENT && IMPLEMENTATION_BPEL.equals(reader.getName())) { + break; + } + } + + try { + bpelProcessor.read(reader); + + fail("InvalidException should have been thrown"); + } catch(Exception e) { + assertTrue(true); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/EmbeddedODEServerTestCase.java b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/EmbeddedODEServerTestCase.java new file mode 100644 index 0000000000..5cf8586fe0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/EmbeddedODEServerTestCase.java @@ -0,0 +1,128 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.implementation.bpel; + +import java.io.File; +import java.net.URL; +import java.util.concurrent.Future; + +import javax.transaction.TransactionManager; +import javax.xml.namespace.QName; + +import junit.framework.TestCase; + +import org.apache.ode.bpel.iapi.Message; +import org.apache.ode.bpel.iapi.MyRoleMessageExchange; +import org.apache.ode.bpel.iapi.MessageExchange.Status; +import org.apache.ode.utils.DOMUtils; +import org.apache.ode.utils.GUID; +import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer; +import org.apache.tuscany.sca.implementation.bpel.ode.GeronimoTxFactory; +import org.apache.tuscany.sca.implementation.bpel.ode.ODEDeployment; +import org.w3c.dom.Element; + +/** + * Test to Deploy and Invoke a HelloWorld BPEL process using EmbeddedODEServer + * + * @version $Rev$ $Date$ + */ +public class EmbeddedODEServerTestCase extends TestCase { + + private EmbeddedODEServer odeServer; + + private TransactionManager txMgr; + + @Override + protected void setUp() throws Exception { + GeronimoTxFactory txFactory = new GeronimoTxFactory(); + txMgr = txFactory.getTransactionManager(); + + this.odeServer = new EmbeddedODEServer(txMgr); + odeServer.init(); + } + + @Override + protected void tearDown() throws Exception { + odeServer.stop(); + } + + public void testProcessInvocation() throws Exception { + if (!odeServer.isInitialized()) { + fail("Server did not start !"); + } + + URL deployURL = getClass().getClassLoader().getResource("deploy.xml"); + File deploymentDir = new File(deployURL.toURI().getPath()).getParentFile(); + System.out.println("Deploying : " + deploymentDir.toString()); + System.out.println(deploymentDir); + if (odeServer.isInitialized()) { + try { + txMgr.begin(); + odeServer.deploy(new ODEDeployment(deploymentDir)); + txMgr.commit(); + } catch (Exception e) { + e.printStackTrace(); + txMgr.rollback(); + } + + // transaction one + MyRoleMessageExchange mex = null; + Future onhold = null; + try { + // invoke the process + txMgr.begin(); + mex = odeServer.getBpelServer().getEngine().createMessageExchange(new GUID().toString(), + new QName("http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl", "HelloService"), "hello"); + + Message request = mex.createMessage(new QName("", "")); + request.setMessage(DOMUtils.stringToDOM("<message><TestPart><hello xmlns=\"http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl\">Hello</hello></TestPart></message>")); + onhold = mex.invoke(request); + txMgr.commit(); + } catch (Exception e) { + e.printStackTrace(); + txMgr.rollback(); + } + // - end of transaction one + + // Waiting until the reply is ready in case the engine needs to continue in a different thread + if (onhold != null) + onhold.get(); + + // transaction two + try { + txMgr.begin(); + // Reloading the mex in the current transaction, otherwise we can't be sure we have + // the "freshest" one. + mex = (MyRoleMessageExchange) odeServer.getBpelServer().getEngine().getMessageExchange(mex.getMessageExchangeId()); + + Status status = mex.getStatus(); + System.out.println("Status: " + status.name()); + Element response = mex.getResponse().getMessage(); + System.out.println("Response: " + DOMUtils.domToString(response)); + txMgr.commit(); + // end of transaction two + } catch (Exception e) { + e.printStackTrace(); + txMgr.rollback(); + } + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/resources/deploy.xml b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/resources/deploy.xml new file mode 100644 index 0000000000..571aa37d58 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/resources/deploy.xml @@ -0,0 +1,30 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> +<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03" + xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld" + xmlns:wns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"> + + + <process name="tns:HelloWorld"> + <active>true</active> + <provide partnerLink="helloPartnerLink"> + <service name="wns:HelloService" port="HelloPort"/> + </provide> + </process> +</deploy> diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/resources/helloworld.bpel b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/resources/helloworld.bpel new file mode 100644 index 0000000000..e983899d76 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/resources/helloworld.bpel @@ -0,0 +1,66 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> +<process name="HelloWorld" + targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:test="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl" + queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0" + expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"> + + <import location="helloworld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/" + namespace="file:///home/mriou/dev/projects/ode/distro-axis2/src/examples/HelloWorld2/HelloWorld2.wsdl"/> + + <partnerLinks> + <partnerLink name="helloPartnerLink" partnerLinkType="test:HelloPartnerLinkType" myRole="me" /> + </partnerLinks> + + <variables> + <variable name="myVar" messageType="test:HelloMessage"/> + <variable name="tmpVar" type="xsd:string"/> + </variables> + + <sequence> + <receive + name="start" + partnerLink="helloPartnerLink" + portType="test:HelloPortType" + operation="hello" + variable="myVar" + createInstance="yes"/> + + <assign name="assign1"> + <copy> + <from variable="myVar" part="TestPart"/> + <to variable="tmpVar"/> + </copy> + <copy> + <from>concat($tmpVar,' World')</from> + <to variable="myVar" part="TestPart"/> + </copy> + </assign> + <reply name="end" + partnerLink="helloPartnerLink" + portType="test:HelloPortType" + operation="hello" + variable="myVar"/> + </sequence> +</process> diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/resources/helloworld.componentType b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/resources/helloworld.componentType new file mode 100644 index 0000000000..121064a475 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/resources/helloworld.componentType @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="ASCII"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <service name="HelloService"> + <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.interface(HelloPortType)" /> + </service> + +</componentType> +
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/resources/helloworld.composite b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/resources/helloworld.composite new file mode 100644 index 0000000000..569328b2ae --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/resources/helloworld.composite @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://bpel"
+ xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ name="bpel">
+
+ <component name="BPELHelloWorldComponent">
+ <implementation.bpel process="hns:HelloWorld"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/resources/helloworld.wsdl b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/resources/helloworld.wsdl new file mode 100644 index 0000000000..1cb338b283 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/resources/helloworld.wsdl @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<wsdl:definitions
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="hello">
+ <complexType>
+ <sequence>
+ <element name="message" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part element="tns:hello" name="TestPart"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="TestIn">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="TestOut">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8085/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/resources/log4j.properties b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/resources/log4j.properties new file mode 100644 index 0000000000..03d99cea4f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/modules/implementation-bpel/src/test/resources/log4j.properties @@ -0,0 +1,33 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Set root logger level to WARN and its only appender to CONSOLE
+log4j.rootLogger=WARN, CONSOLE
+
+# log4j properties to work with commandline tools.
+log4j.category.org.mortbay=ERROR
+log4j.category.org.hibernate.type=WARN
+log4j.category.org.objectweb=ERROR
+log4j.category.org.apache.ode.axis2=DEBUG
+log4j.category.org.apache.ode.bpel.engine=DEBUG
+log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=DEBUG
+log4j.category.org.apache.ode.bpel.epr=INFO
+
+# Console appender
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%p - %C{1}.%M(%L) | %m%n
|