From 3dd7e2c4da9c80b8182a2d04dc129a67aa7910df Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 11 Nov 2009 23:06:58 +0000 Subject: Moving 1.x branches git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835121 13f79535-47bb-0310-9956-ffa450edef68 --- .../modules/implementation-bpel/DISCLAIMER | 8 + .../modules/implementation-bpel/LICENSE | 251 ++++++++++++++++ .../modules/implementation-bpel/NOTICE | 17 ++ .../modules/implementation-bpel/pom.xml | 315 +++++++++++++++++++++ .../tuscany/sca/implementation/bpel/BPEL.java | 35 +++ .../implementation/bpel/BPELImplementation.java | 51 ++++ .../bpel/BPELImplementationFactory.java | 36 +++ .../bpel/DefaultBPELImplementationFactory.java | 46 +++ .../bpel/impl/BPELArtifactProcessor.java | 144 ++++++++++ .../bpel/impl/BPELImplementationImpl.java | 214 ++++++++++++++ .../bpel/impl/ODEProcessException.java | 40 +++ .../implementation/bpel/ode/EmbeddedODEServer.java | 151 ++++++++++ .../implementation/bpel/ode/GeronimoTxFactory.java | 43 +++ .../bpel/ode/ODEInitializationException.java | 39 +++ .../bpel/provider/BPELImplementationProvider.java | 75 +++++ .../BPELImplementationProviderFactory.java | 50 ++++ .../implementation/bpel/provider/BPELInvoker.java | 62 ++++ ...ca.contribution.processor.StAXArtifactProcessor | 19 ++ ...cany.sca.provider.ImplementationProviderFactory | 19 ++ .../sca/implementation/bpel/BPELTestCase.java | 59 ++++ .../src/test/resources/HelloWorld.bpel | 66 +++++ .../src/test/resources/HelloWorld.wsdl | 69 +++++ .../src/test/resources/helloworld.componentType | 31 ++ .../src/test/resources/helloworld.composite | 35 +++ 24 files changed, 1875 insertions(+) create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/DISCLAIMER create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/LICENSE create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPEL.java create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationFactory.java create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELImplementationFactory.java create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELArtifactProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/ODEProcessException.java create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.java create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.java create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.java create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/HelloWorld.bpel create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/HelloWorld.wsdl create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/helloworld.componentType create mode 100644 sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/helloworld.composite (limited to 'sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel') diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/DISCLAIMER new file mode 100644 index 0000000000..d68a410903 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/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-0.99/modules/implementation-bpel/LICENSE b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/LICENSE new file mode 100644 index 0000000000..baba9ca048 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/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-0.99/modules/implementation-bpel/NOTICE b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/NOTICE new file mode 100644 index 0000000000..f6366c5162 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/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-0.99/modules/implementation-bpel/pom.xml b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/pom.xml new file mode 100644 index 0000000000..0b2e442e16 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/pom.xml @@ -0,0 +1,315 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-modules + 0.99-incubating-SNAPSHOT + ../pom.xml + + + tuscany-implementation-bpel + Apache Tuscany Implementation BPEL + + + + org.apache.tuscany.sca + tuscany-assembly + 0.99-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-core + 0.99-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-interface + 0.99-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-assembly-xml + 0.99-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-contribution-impl + 0.99-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + sca-api + 0.99-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-databinding + 0.99-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 0.99-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-host-embedded + 0.99-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-interface-wsdl + 0.99-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-interface-wsdl-xml + 0.99-incubating-SNAPSHOT + + + + junit + junit + 3.8.1 + test + + + + org.easymock + easymock + 2.2 + test + + + + org.apache.maven + maven-artifact-ant + 2.0.4 + + + + + org.apache.ode + ode-bpel-epr + 1.0-incubating + + + org.apache.ode + ode-bpel-dao + 1.0-incubating + + + org.apache.ode + ode-bpel-dao + 1.0-incubating + + + org.apache.ode + ode-dao-jpa + 1.0-incubating + + + org.apache.ode + ode-dao-jpa-ojpa-derby + 1.0-incubating + zip + + + org.apache.ode + ode-bpel-runtime + 1.0-incubating + + + org.apache.ode + ode-bpel-api + 1.0-incubating + + + org.apache.ode + ode-bpel-scheduler-quartz + 1.0-incubating + + + org.apache.ode + ode-utils + 1.0-incubating + + + org.apache.ode + ode-bpel-compiler + 1.0-incubating + + + org.apache.ode + ode-bpel-schemas + 1.0-incubating + + + org.apache.ode + ode-bpel-obj + 1.0-incubating + + + + + commons-logging + commons-logging + 1.1 + + + org.apache.geronimo.specs + geronimo-jta_1.0.1B_spec + 1.0 + + + org.apache.geronimo.modules + geronimo-kernel + 1.2-beta + + + org.apache.geronimo.modules + geronimo-transaction + 1.2-beta + + + org.apache.geronimo.modules + geronimo-connector + 1.2-beta + + + org.apache.derby + derby + 10.1.3.1 + + + tranql + tranql-connector + 1.1 + + + axion + axion + 1.0-M3-dev + + + quartz + quartz + 1.5.2 + + + org.apache.openjpa + openjpa-all + 0.9.7-incubating + + + net.sourceforge.serp + serp + 1.12.0 + + + commons-primitives + commons-primitives + 1.0 + + + commons-collections + commons-collections + 3.1 + + + commons-lang + commons-lang + 2.1 + + + xerces + xercesImpl + 2.8.0 + + + xalan + xalan + 2.7.0 + + + jaxen + jaxen + 1.1-beta-8 + + + net.sf.saxon + saxon + 8.7 + + + net.sf.saxon + saxon-dom + 8.7 + + + net.sf.saxon + saxon-xpath + 8.7 + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + test-compile + + unpack + + + + + org.apache.ode + ode-dao-jpa-ojpa-derby + 1.0-incubating + zip + true + ${project.build.directory}/test-classes/ + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPEL.java b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPEL.java new file mode 100644 index 0000000000..c474c59d51 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPEL.java @@ -0,0 +1,35 @@ +/* + * 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; + +/** + * The service interface of the single BPEL service provided by BPEL components. + * + * @version $Rev$ $Date$ + */ +public interface BPEL { + + /** + * Invoke a bpel process + * @param object + * @return object + */ + Object invokeProcess(Object object); + +} diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java new file mode 100644 index 0000000000..9e3adefe5c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java @@ -0,0 +1,51 @@ +/* + * 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.Extensible; +import org.apache.tuscany.sca.assembly.Implementation; +import org.apache.ode.bpel.iapi.ProcessConf; + +import javax.xml.namespace.QName; + +/** + * The model representing the BPEL implementation in an SCA assembly model. + * + * @version $Rev$ $Date$ + */ +public interface BPELImplementation extends Implementation, Extensible { + + /** + * Builds the process configuration used by ODE to get deployment and configuration + * level information about a process. + * @return + */ + ProcessConf getProcessConf(); + + /** + * Sets the implementation compiled process bytes + * @param compiledProcess serialized compiled process + */ + void setCompiledProcess(byte[] compiledProcess); + + /** + * @param processName process QName + */ + void setProcessName(QName processName); +} diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationFactory.java b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationFactory.java new file mode 100644 index 0000000000..9df99b6069 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationFactory.java @@ -0,0 +1,36 @@ +/* + * 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 BPELImplementationFactory { + + /** + * Creates a new CRUD implementation. + * + * @return + */ + BPELImplementation createBPELImplementation(); + +} diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELImplementationFactory.java b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELImplementationFactory.java new file mode 100644 index 0000000000..28bc603c8b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELImplementationFactory.java @@ -0,0 +1,46 @@ +/* + * 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.implementation.bpel.impl.BPELImplementationImpl; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory; + +/** + * A default factory for the BPEL implementation model. + * + * @version $Rev$ $Date$ + */ +public class DefaultBPELImplementationFactory implements BPELImplementationFactory { + + private AssemblyFactory assemblyFactory; + private WSDLFactory wsdlFactory; + + public DefaultBPELImplementationFactory(AssemblyFactory assemblyFactory, + WSDLFactory wsdlFactory) { + this.assemblyFactory = assemblyFactory; + this.wsdlFactory = wsdlFactory; + } + + public BPELImplementation createBPELImplementation() { + return new BPELImplementationImpl(assemblyFactory, wsdlFactory); + } + +} diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELArtifactProcessor.java b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELArtifactProcessor.java new file mode 100644 index 0000000000..1bb88496b4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELArtifactProcessor.java @@ -0,0 +1,144 @@ +/* + * 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.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.net.URL; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamWriter; + +import org.apache.ode.bpel.compiler.BpelC; +import org.apache.tuscany.sca.assembly.AssemblyFactory; +import org.apache.tuscany.sca.assembly.xml.Constants; +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +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.implementation.bpel.BPELImplementation; +import org.apache.tuscany.sca.implementation.bpel.BPELImplementationFactory; +import org.apache.tuscany.sca.implementation.bpel.DefaultBPELImplementationFactory; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory; + +/** + * Implements a STAX artifact processor for BPEL implementations. + * + * The artifact processor is responsible for processing + * 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 BPELArtifactProcessor implements StAXArtifactProcessor { + private static final QName IMPLEMENTATION_BPEL = new QName(Constants.SCA10_TUSCANY_NS, "implementation.bpel"); + + private BPELImplementationFactory bpelFactory; + + public BPELArtifactProcessor(ModelFactoryExtensionPoint modelFactories) { + AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); + WSDLFactory wsdlFactory = modelFactories.getFactory(WSDLFactory.class); + this.bpelFactory = new DefaultBPELImplementationFactory(assemblyFactory, wsdlFactory); + } + + public QName getArtifactType() { + // Returns the qname of the XML element processed by this processor + return IMPLEMENTATION_BPEL; + } + + public Class getModelType() { + // Returns the type of model processed by this processor + return BPELImplementation.class; + } + + public BPELImplementation read(XMLStreamReader reader) throws ContributionReadException { + assert IMPLEMENTATION_BPEL.equals(reader.getName()); + + // Read an element + try { + // Read the process attribute. + QName process = getAttributeValueNS(reader, "process"); + String bpelFile = reader.getAttributeValue(null, "file"); + + // 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(); + } + + // Create an initialize the BPEL implementation model + BPELImplementation implementation = bpelFactory.createBPELImplementation(); + implementation.setProcessName(process); + implementation.setCompiledProcess(compiledProcess.toByteArray()); + implementation.setUnresolved(false); + + // Skip to end element + while (reader.hasNext()) { + if (reader.next() == END_ELEMENT && IMPLEMENTATION_BPEL.equals(reader.getName())) { + break; + } + } + + return implementation; + } catch (XMLStreamException e) { + throw new ContributionReadException(e); + } + } + + public void resolve(BPELImplementation impl, ModelResolver resolver) throws ContributionResolveException { + System.out.println("IN RESOLVE"); + if( impl != null && impl.isUnresolved()) { + + impl.setUnresolved(false); + } + + } + + public void write(BPELImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException { + } + + 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-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java new file mode 100644 index 0000000000..81401f0c72 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.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.impl; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.InputStream; +import java.net.URL; +import java.util.ArrayList; +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.implementation.bpel.BPELImplementation; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory; +import org.apache.tuscany.sca.policy.Intent; +import org.apache.tuscany.sca.policy.IntentAttachPointType; +import org.apache.tuscany.sca.policy.PolicySet; +import org.w3c.dom.Node; + +/** + * The model representing a BPEL implementation in an SCA assembly model. + * + * @version $Rev$ $Date$ + */ +public class BPELImplementationImpl implements BPELImplementation { + + private Service _bpelService; + private QName _processName; + private byte[] _compiledProcess; + private boolean unresolved; + + /** + * Constructs a new BPEL implementation. + */ + public BPELImplementationImpl(AssemblyFactory assemblyFactory, + WSDLFactory wsdlFactory) { + + _bpelService = assemblyFactory.createService(); + _bpelService.setName("BPEL"); +// WSDLInterface wsdlInterface; +// try { +// wsdlInterface = introspector.introspect(BPEL.class); +// } catch (InvalidInterfaceException e) { +// throw new IllegalArgumentException(e); +// } +// WSDLInterfaceContract interfaceContract = wsdlFactory.createWSDLInterfaceContract(); +// interfaceContract.setInterface(wsdlInterface); +// _bpelService.setInterfaceContract(interfaceContract); + } + + public void setCompiledProcess(byte[] compiledProcess) { + _compiledProcess = compiledProcess; + } + + public void setProcessName(QName processName) { + _processName = processName; + } + + public ProcessConf getProcessConf() { + return null; + } + + public ConstrainingType getConstrainingType() { + // The sample BPEL implementation does not support constrainingTypes + return null; + } + + public List getProperties() { + // The sample BPEL implementation does not support properties + return Collections.emptyList(); + } + + public List getServices() { + // The sample BPEL implementation provides a single fixed CRUD service + return Collections.singletonList(_bpelService); + } + + public List getReferences() { + // The sample BPEL implementation does not support properties + return Collections.emptyList(); + } + + public String getURI() { + // The sample BPEL implementation does not have a URI + return null; + } + + public void setConstrainingType(ConstrainingType constrainingType) { + // The sample BPEL implementation does not support constrainingTypes + } + + public void setURI(String uri) { + // The sample BPEL implementation does not have a URI + } + + + public List getExtensions() { + // The sample BPEL implementation does not support extensions + 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 new ByteArrayInputStream(_compiledProcess); + } + + public String getBpelDocument() { + return null; + } + + public URL getBaseURL() { + return null; + } + + public Date getDeployDate() { + return null; + } + + public String getDeployer() { + return null; + } + + public ProcessState getState() { + return null; + } + + public List getFiles() { + return null; + } + + public Map getProperties() { + return null; + } + + public String getPackage() { + return null; + } + + public Definition getDefinitionForService(QName qName) { + return null; + } + + public Definition getDefinitionForPortType(QName qName) { + return null; + } + + public Map getProvideEndpoints() { + return null; + } + + public Map getInvokeEndpoints() { + return null; + } + + public boolean isEventEnabled(List strings, BpelEvent.TYPE type) { + return true; + } + } +} diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/ODEProcessException.java b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/ODEProcessException.java new file mode 100644 index 0000000000..34743896b1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/ODEProcessException.java @@ -0,0 +1,40 @@ +/* + * 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. + */ +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-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java new file mode 100644 index 0000000000..5846c90150 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java @@ -0,0 +1,151 @@ +/* + * 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.il.config.OdeConfigProperties; +import org.apache.ode.il.dbutil.Database; +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.memdao.BpelDAOConnectionFactoryImpl; +import org.apache.ode.bpel.scheduler.quartz.QuartzSchedulerImpl; +import org.apache.ode.bpel.iapi.Scheduler; + +import java.util.Properties; +import java.util.concurrent.Executors; +import java.util.concurrent.ExecutorService; +import java.io.File; +import java.net.URL; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.transaction.TransactionManager; + +/** + * + */ +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; + private ExecutorService _executor; + private Scheduler _scheduler; + + 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() { + 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 MessageExchangeContextImpl(this)); +// _bpelServer.setBindingContext(new BindingContextImpl(this, _store)); + _bpelServer.setScheduler(_scheduler); + if (_config.isDehydrationEnabled()) { + CountLRUDehydrationPolicy dehy = new CountLRUDehydrationPolicy(); + _bpelServer.setDehydrationPolicy(dehy); + } + _bpelServer.init(); + } + + protected Scheduler createScheduler() { + QuartzSchedulerImpl scheduler = new QuartzSchedulerImpl(); + scheduler.setExecutorService(_executor, 20); + scheduler.setTransactionManager(_txMgr); + scheduler.setDataSource(_db.getDataSource()); + scheduler.init(); + return scheduler; + } + + public boolean isInitialized() { + return _initialized; + } + + public BpelServerImpl getBpelServer() { + return _bpelServer; + } +} diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java new file mode 100644 index 0000000000..d20dbe6ffc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.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.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.transaction.TransactionManager; + +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-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java new file mode 100644 index 0000000000..bf8f55be3d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java @@ -0,0 +1,39 @@ +/* + * 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. + */ +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-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.java b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.java new file mode 100644 index 0000000000..e95bb80438 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.java @@ -0,0 +1,75 @@ +/* + * 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 org.apache.tuscany.sca.implementation.bpel.BPELImplementation; +import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer; +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 BPELImplementation implementation; + private EmbeddedODEServer odeServer; + + /** + * Constructs a new CRUD implementation. + */ + public BPELImplementationProvider(RuntimeComponent component, BPELImplementation implementation, + EmbeddedODEServer odeServer) { + this.component = component; + this.implementation = implementation; + this.odeServer = odeServer; + } + + public Invoker createInvoker(RuntimeComponentService service, Operation operation) { + BPELInvoker invoker = new BPELInvoker(operation); + return invoker; + } + + public Invoker createCallbackInvoker(Operation operation) { + BPELInvoker invoker = new BPELInvoker(operation); + return invoker; + } + + public void start() { + System.out.println("Starting " + component.getName() + " " + component.getClass().getName()); + if (!odeServer.isInitialized()) odeServer.init(); + + 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-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.java b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.java new file mode 100644 index 0000000000..33112dbc0c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.java @@ -0,0 +1,50 @@ +/* + * 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 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.provider.ImplementationProvider; +import org.apache.tuscany.sca.provider.ImplementationProviderFactory; +import org.apache.tuscany.sca.runtime.RuntimeComponent; + +/** + * The model representing a sample CRUD implementation in an SCA assembly model. + */ +public class BPELImplementationProviderFactory implements ImplementationProviderFactory { + + private EmbeddedODEServer odeServer; + + /** + * Constructs a new CRUD implementation. + * @param odeServer the server instance passed to the implementation provider + */ + public BPELImplementationProviderFactory(ExtensionPointRegistry extensionPoints) { + this.odeServer = new EmbeddedODEServer(); + } + + public ImplementationProvider createImplementationProvider(RuntimeComponent component, BPELImplementation implementation) { + return new BPELImplementationProvider(component, implementation, odeServer); + } + + public Class getModelType() { + return BPELImplementation.class; + } +} diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.java b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.java new file mode 100644 index 0000000000..b786f00266 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.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.provider; + +import java.lang.reflect.InvocationTargetException; + +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; + +/** + * Implements a target invoker for CRUD 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 Operation operation; + + public BPELInvoker(Operation operation) { + this.operation = operation; + } + + 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 { + if (operation.getName().equals("invokeProcess")) { + return args[0]; + } else { + return null; + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor new file mode 100644 index 0000000000..91b67833a8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/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.BPELArtifactProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.bpel,model=org.apache.tuscany.sca.implementation.bpel.BPELImplementation diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/sca-java-1.x/branches/sca-java-0.99/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-0.99/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-0.99/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELTestCase.java b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELTestCase.java new file mode 100644 index 0000000000..0a872c7df8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELTestCase.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.sca.host.embedded.SCADomain; + +/** + * Tests the BPEL service + * + * @version $Rev$ $Date$ + */ +public class BPELTestCase extends TestCase { + + private SCADomain scaDomain; + private BPEL bpelService; + + /** + * @throws java.lang.Exception + */ + protected void setUp() throws Exception { + //scaDomain = SCADomain.newInstance("helloworld.composite"); + //bpelService = scaDomain.getService(BPEL.class, "BPELHelloWorldComponent"); + + } + + /** + * @throws java.lang.Exception + */ + protected void tearDown() throws Exception { + //scaDomain.close(); + } + + + public void testCRUD() throws Exception { + //Object result = bpelService.invokeProcess("something"); + //assertEquals("something", result); + } + + +} diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/HelloWorld.bpel b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/HelloWorld.bpel new file mode 100644 index 0000000000..7156fa11b6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/HelloWorld.bpel @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + concat($tmpVar,' World') + + + + + + diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/HelloWorld.wsdl b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/HelloWorld.wsdl new file mode 100644 index 0000000000..a2ae0c5fa5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/HelloWorld.wsdl @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/helloworld.componentType b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/helloworld.componentType new file mode 100644 index 0000000000..9360403f7e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/helloworld.componentType @@ -0,0 +1,31 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/helloworld.composite b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/helloworld.composite new file mode 100644 index 0000000000..7930685e47 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/implementation-bpel/src/test/resources/helloworld.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + -- cgit v1.2.3