From dcabb3cb1762b15ac06abb04e7134dd58010f82d Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 20 May 2009 06:37:05 +0000 Subject: Renaming implementation-bpel-ode to implementation-bpel-runtime to follow the name pattern used by other modules git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@776591 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/resources/archetype-resources/pom.xml | 2 +- java/sca/features/process/pom.xml | 2 +- java/sca/modules/implementation-bpel-ode/LICENSE | 251 ------------ .../implementation-bpel-ode/META-INF/MANIFEST.MF | 46 --- java/sca/modules/implementation-bpel-ode/NOTICE | 17 - java/sca/modules/implementation-bpel-ode/pom.xml | 446 --------------------- .../implementation/bpel/ode/BPELODEDeployFile.java | 227 ----------- .../implementation/bpel/ode/EmbeddedODEServer.java | 266 ------------ .../implementation/bpel/ode/GeronimoTxFactory.java | 48 --- .../implementation/bpel/ode/ODEBindingContext.java | 79 ---- .../sca/implementation/bpel/ode/ODEDeployment.java | 44 -- .../bpel/ode/ODEDeploymentException.java | 41 -- .../bpel/ode/ODEExternalService.java | 285 ------------- .../bpel/ode/ODEInitializationException.java | 41 -- .../bpel/ode/ODEMessageExchangeContext.java | 57 --- .../bpel/ode/ODEShutdownException.java | 41 -- .../sca/implementation/bpel/ode/TuscanyEPR.java | 49 --- .../sca/implementation/bpel/ode/TuscanyPRC.java | 65 --- .../bpel/ode/TuscanyProcessConfImpl.java | 437 -------------------- .../ode/provider/BPELImplementationProvider.java | 146 ------- .../BPELImplementationProviderFactory.java | 69 ---- .../bpel/ode/provider/BPELInvoker.java | 242 ----------- ...cany.sca.provider.ImplementationProviderFactory | 19 - .../bpel/ode/EmbeddedODEServerTestCase.java | 124 ------ .../src/test/resources/helloworld/deploy.xml | 30 -- .../src/test/resources/helloworld/greetings.wsdl | 87 ---- .../src/test/resources/helloworld/helloworld.bpel | 66 --- .../src/test/resources/helloworld/helloworld.wsdl | 82 ---- .../src/test/resources/log4j.properties | 36 -- .../modules/implementation-bpel-runtime/LICENSE | 251 ++++++++++++ .../META-INF/MANIFEST.MF | 46 +++ .../sca/modules/implementation-bpel-runtime/NOTICE | 17 + .../modules/implementation-bpel-runtime/pom.xml | 446 +++++++++++++++++++++ .../implementation/bpel/ode/BPELODEDeployFile.java | 227 +++++++++++ .../implementation/bpel/ode/EmbeddedODEServer.java | 266 ++++++++++++ .../implementation/bpel/ode/GeronimoTxFactory.java | 48 +++ .../implementation/bpel/ode/ODEBindingContext.java | 79 ++++ .../sca/implementation/bpel/ode/ODEDeployment.java | 44 ++ .../bpel/ode/ODEDeploymentException.java | 41 ++ .../bpel/ode/ODEExternalService.java | 285 +++++++++++++ .../bpel/ode/ODEInitializationException.java | 41 ++ .../bpel/ode/ODEMessageExchangeContext.java | 57 +++ .../bpel/ode/ODEShutdownException.java | 41 ++ .../sca/implementation/bpel/ode/TuscanyEPR.java | 49 +++ .../sca/implementation/bpel/ode/TuscanyPRC.java | 65 +++ .../bpel/ode/TuscanyProcessConfImpl.java | 437 ++++++++++++++++++++ .../ode/provider/BPELImplementationProvider.java | 146 +++++++ .../BPELImplementationProviderFactory.java | 69 ++++ .../bpel/ode/provider/BPELInvoker.java | 242 +++++++++++ ...cany.sca.provider.ImplementationProviderFactory | 19 + .../bpel/ode/EmbeddedODEServerTestCase.java | 124 ++++++ .../src/test/resources/helloworld/deploy.xml | 30 ++ .../src/test/resources/helloworld/greetings.wsdl | 87 ++++ .../src/test/resources/helloworld/helloworld.bpel | 66 +++ .../src/test/resources/helloworld/helloworld.wsdl | 82 ++++ .../src/test/resources/log4j.properties | 36 ++ java/sca/modules/pom.xml | 2 +- java/sca/samples/helloworld-bpel/pom.xml | 2 +- 58 files changed, 3345 insertions(+), 3345 deletions(-) delete mode 100644 java/sca/modules/implementation-bpel-ode/LICENSE delete mode 100644 java/sca/modules/implementation-bpel-ode/META-INF/MANIFEST.MF delete mode 100644 java/sca/modules/implementation-bpel-ode/NOTICE delete mode 100644 java/sca/modules/implementation-bpel-ode/pom.xml delete mode 100644 java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/BPELODEDeployFile.java delete mode 100644 java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java delete mode 100644 java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java delete mode 100644 java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java delete mode 100644 java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java delete mode 100644 java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.java delete mode 100644 java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java delete mode 100644 java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java delete mode 100644 java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java delete mode 100644 java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java delete mode 100644 java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyEPR.java delete mode 100644 java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyPRC.java delete mode 100644 java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java delete mode 100644 java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java delete mode 100644 java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProviderFactory.java delete mode 100644 java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java delete mode 100644 java/sca/modules/implementation-bpel-ode/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory delete mode 100644 java/sca/modules/implementation-bpel-ode/src/test/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServerTestCase.java delete mode 100644 java/sca/modules/implementation-bpel-ode/src/test/resources/helloworld/deploy.xml delete mode 100644 java/sca/modules/implementation-bpel-ode/src/test/resources/helloworld/greetings.wsdl delete mode 100644 java/sca/modules/implementation-bpel-ode/src/test/resources/helloworld/helloworld.bpel delete mode 100644 java/sca/modules/implementation-bpel-ode/src/test/resources/helloworld/helloworld.wsdl delete mode 100644 java/sca/modules/implementation-bpel-ode/src/test/resources/log4j.properties create mode 100644 java/sca/modules/implementation-bpel-runtime/LICENSE create mode 100644 java/sca/modules/implementation-bpel-runtime/META-INF/MANIFEST.MF create mode 100644 java/sca/modules/implementation-bpel-runtime/NOTICE create mode 100644 java/sca/modules/implementation-bpel-runtime/pom.xml create mode 100644 java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/BPELODEDeployFile.java create mode 100644 java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java create mode 100644 java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java create mode 100644 java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java create mode 100644 java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java create mode 100644 java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.java create mode 100644 java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java create mode 100644 java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java create mode 100644 java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java create mode 100644 java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java create mode 100644 java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyEPR.java create mode 100644 java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyPRC.java create mode 100644 java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java create mode 100644 java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java create mode 100644 java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProviderFactory.java create mode 100644 java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java create mode 100644 java/sca/modules/implementation-bpel-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory create mode 100644 java/sca/modules/implementation-bpel-runtime/src/test/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServerTestCase.java create mode 100644 java/sca/modules/implementation-bpel-runtime/src/test/resources/helloworld/deploy.xml create mode 100644 java/sca/modules/implementation-bpel-runtime/src/test/resources/helloworld/greetings.wsdl create mode 100644 java/sca/modules/implementation-bpel-runtime/src/test/resources/helloworld/helloworld.bpel create mode 100644 java/sca/modules/implementation-bpel-runtime/src/test/resources/helloworld/helloworld.wsdl create mode 100644 java/sca/modules/implementation-bpel-runtime/src/test/resources/log4j.properties diff --git a/java/sca/archetypes/quickstart-bpel/src/main/resources/archetype-resources/pom.xml b/java/sca/archetypes/quickstart-bpel/src/main/resources/archetype-resources/pom.xml index d6c8dfd621..f8fba3c68e 100644 --- a/java/sca/archetypes/quickstart-bpel/src/main/resources/archetype-resources/pom.xml +++ b/java/sca/archetypes/quickstart-bpel/src/main/resources/archetype-resources/pom.xml @@ -46,7 +46,7 @@ org.apache.tuscany.sca - tuscany-implementation-bpel-ode + tuscany-implementation-bpel-runtime ${tuscany.version} runtime diff --git a/java/sca/features/process/pom.xml b/java/sca/features/process/pom.xml index 037beaecc6..1ee4a0fe6f 100644 --- a/java/sca/features/process/pom.xml +++ b/java/sca/features/process/pom.xml @@ -48,7 +48,7 @@ org.apache.tuscany.sca - tuscany-implementation-bpel-ode + tuscany-implementation-bpel-runtime 2.0-SNAPSHOT diff --git a/java/sca/modules/implementation-bpel-ode/LICENSE b/java/sca/modules/implementation-bpel-ode/LICENSE deleted file mode 100644 index baba9ca048..0000000000 --- a/java/sca/modules/implementation-bpel-ode/LICENSE +++ /dev/null @@ -1,251 +0,0 @@ - - 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/java/sca/modules/implementation-bpel-ode/META-INF/MANIFEST.MF b/java/sca/modules/implementation-bpel-ode/META-INF/MANIFEST.MF deleted file mode 100644 index 5e8ef59631..0000000000 --- a/java/sca/modules/implementation-bpel-ode/META-INF/MANIFEST.MF +++ /dev/null @@ -1,46 +0,0 @@ -Manifest-Version: 1.0 -Private-Package: org.apache.tuscany.sca.implementation.bpel.ode;versio - n="2.0",org.apache.tuscany.sca.implementation.bpel.ode.provider;versi - on="2.0" -Tool: Bnd-0.0.255 -Bundle-Name: Apache Tuscany SCA BPEL ODE Implementation Extension -Created-By: 1.6.0_07 (Sun Microsystems Inc.) -Bundle-Vendor: The Apache Software Foundation -Bundle-Version: 2.0 -Bnd-LastModified: 1225397447609 -Bundle-ManifestVersion: 2 -Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt -Bundle-Description: Apache Tuscany SCA BPEL ODE Implementation Extensi - on -Import-Package: javax.resource.spi, - javax.sql, - javax.transaction;version="1.1.0", - javax.wsdl, - javax.xml.namespace, - org.apache.commons.logging, - org.apache.geronimo.transaction.manager, - org.apache.ode.bpel.compiler, - org.apache.ode.bpel.dao, - org.apache.ode.bpel.engine, - org.apache.ode.bpel.evt, - org.apache.ode.bpel.iapi, - org.apache.ode.bpel.memdao, - org.apache.ode.il.config, - org.apache.ode.il.dbutil, - org.apache.ode.scheduler.simple, - org.apache.ode.utils, - org.apache.tuscany.sca.assembly;version="2.0", - org.apache.tuscany.sca.core;version="2.0", - org.apache.tuscany.sca.databinding.xml;version="2.0", - org.apache.tuscany.sca.implementation.bpel;version="2.0", - org.apache.tuscany.sca.interfacedef;version="2.0", - org.apache.tuscany.sca.interfacedef.wsdl;version="2.0", - org.apache.tuscany.sca.invocation;version="2.0", - org.apache.tuscany.sca.policy;version="2.0.0", - org.apache.tuscany.sca.provider;version="2.0", - org.apache.tuscany.sca.runtime;version="2.0", - org.oasisopen.sca.annotation;version="2.0", - org.w3c.dom -Bundle-SymbolicName: org.apache.tuscany.sca.implementation.bpel.ode -Bundle-DocURL: http://www.apache.org/ -Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6 diff --git a/java/sca/modules/implementation-bpel-ode/NOTICE b/java/sca/modules/implementation-bpel-ode/NOTICE deleted file mode 100644 index a2f696be26..0000000000 --- a/java/sca/modules/implementation-bpel-ode/NOTICE +++ /dev/null @@ -1,17 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2008 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/java/sca/modules/implementation-bpel-ode/pom.xml b/java/sca/modules/implementation-bpel-ode/pom.xml deleted file mode 100644 index 5e6e263f94..0000000000 --- a/java/sca/modules/implementation-bpel-ode/pom.xml +++ /dev/null @@ -1,446 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-modules - 2.0-SNAPSHOT - ../pom.xml - - tuscany-implementation-bpel-ode - Apache Tuscany SCA BPEL ODE Implementation Extension - - - org.apache.tuscany.sca - tuscany-assembly - 2.0-SNAPSHOT - - - org.apache.tuscany.sca - tuscany-implementation-bpel - 2.0-SNAPSHOT - - - org.apache.tuscany.sca - tuscany-core - 2.0-SNAPSHOT - - - org.apache.tuscany.sca - tuscany-interface - 2.0-SNAPSHOT - - - org.apache.tuscany.sca - tuscany-assembly-xml - 2.0-SNAPSHOT - - - org.apache.tuscany.sca - tuscany-contribution - 2.0-SNAPSHOT - - - org.apache.tuscany.sca - tuscany-sca-api - 2.0-SNAPSHOT - - - org.apache.tuscany.sca - tuscany-databinding - 2.0-SNAPSHOT - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - - - org.apache.tuscany.sca - tuscany-node-impl - 2.0-SNAPSHOT - - - org.apache.tuscany.sca - tuscany-interface-wsdl - 2.0-SNAPSHOT - - - - - org.apache.ode - ode-bpel-epr - 1.1.1 - - - org.apache.ode - ode-bpel-store - 1.1.1 - - - org.apache.ode - ode-bpel-dao - 1.1.1 - - - org.apache.ode - ode-bpel-dao - 1.1.1 - - - org.apache.ode - ode-dao-jpa - 1.1.1 - - - org.apache.ode - ode-dao-jpa-ojpa-derby - 1.1.1 - zip - - - org.apache.ode - ode-bpel-runtime - 1.1.1 - - - org.apache.ode - ode-bpel-api - 1.1.1 - - - org.apache.ode - ode-scheduler-simple - 1.1.1 - - - org.apache.ode - ode-utils - 1.1.1 - - - org.apache.ode - ode-bpel-compiler - 1.1.1 - - - org.apache.ode - ode-bpel-schemas - 1.1.1 - - - org.apache.ode - ode-bpel-obj - 1.1.1 - - - org.apache.ode - ode-jacob - 1.1.1 - - - org.apache.ode - ode-jacob-ap - 1.1.1 - - - - - commons-lang - commons-lang - 2.1 - - - commons-collections - commons-collections - 3.1 - - - org.apache.geronimo.specs - geronimo-jta_1.1_spec - 1.1.1 - - - org.apache.geronimo.modules - geronimo-kernel - 1.2-beta - - - mx4j - mx4j - - - cglib - cglib-nodep - - - xpp3 - xpp3 - - - xstream - xstream - - - - - org.apache.geronimo.modules - geronimo-transaction - 1.2-beta - - - org.apache.geronimo.specs - geronimo-jta_1.0.1B_spec - - - org.apache.geronimo.specs - geronimo-ejb_2.1_spec - - - ognl - ognl - - - junit - junit - - - - - org.apache.geronimo.specs - geronimo-ejb_3.0_spec - 1.0 - - - org.apache.geronimo.modules - geronimo-connector - 1.2-beta - - - org.apache.geronimo.specs - geronimo-jta_1.0.1B_spec - - - xmlbeans - xbean - - - stax - stax-api - - - - - org.apache.derby - derby - 10.3.1.4 - - - tranql - tranql-connector - 1.1 - - - geronimo-spec - geronimo-spec-jta - - - junit - junit - - - - - org.apache.openjpa - openjpa-all - 0.9.7-incubating - - - org.apache.openjpa - openjpa-lib - - - org.apache.openjpa - openjpa-kernel - - - org.apache.openjpa - openjpa-kernel-5 - - - org.apache.openjpa - openjpa-jdbc - - - org.apache.openjpa - openjpa-jdbc-5 - - - org.apache.openjpa - openjpa-persistence-jdbc - - - org.apache.openjpa - openjpa-xmlstore - - - junit - junit - - - - - net.sourceforge.serp - serp - 1.12.0 - - - junit - junit - - - - - jaxen - jaxen - 1.1.1 - - - xom - xom - - - xml-apis - xml-apis - - - - - xalan - xalan - 2.7.0 - - - xml-apis - xml-apis - - - - - xerces - xercesImpl - 2.8.1 - - - xml-apis - xml-apis - - - - - org.apache.xmlbeans - xmlbeans - 2.3.0 - - - stax - stax-api - - - - - net.sf.saxon - saxon - 8.7 - - - - net.sf.saxon - saxon-dom - 8.7 - - - - net.sf.saxon - saxon-xpath - 8.7 - - - commons-codec - commons-codec - 1.3 - - - commons-codec - commons-codec - - - - - log4j - log4j - 1.2.13 - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - 2.3.1 - - false - false - true - - - - org.apache.maven.plugins - maven-dependency-plugin - - - unpack - generate-sources - - unpack - - - - - org.apache.ode - ode-dao-jpa-ojpa-derby - 1.1.1 - zip - true - ${project.build.directory}/test-classes/ - - - - - - - - - - - diff --git a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/BPELODEDeployFile.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/BPELODEDeployFile.java deleted file mode 100644 index 5ad8b7c5d9..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/BPELODEDeployFile.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * 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.io.FileOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.net.URI; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.tuscany.sca.assembly.ComponentType; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.implementation.bpel.BPELImplementation; - -/** - * A class that handles the deploy.xml file required for each BPEL process by the ODE runtime - * @author Mike Edwards - * - * An explanation of the structure of the ODE deploy file: - * - * - * - * - * true - * - * - * - * - * - * - * - * - * - * For SCA purposes: - * - * a) Each partner link in the BPEL process is declared using either a - * (for a service) or using a (for a reference). - * - * b) Each and must use the partnerLink name, as declared in the - * BPEL process. - * - * c) The and elements each have a single child element. - * The elements have name and port attributes. The NAME attribute MUST be set - * to the same name as the partnerLink and MUST be prefixed by a prefix which references - * the namespace "http://tuscany.apache.org" ("tus" in the example above). - * The port attribute can be set to any name (it must be present but it is not actually - * used for anything significant). - * - * When SCA loads a BPEL process to the ODE server, this file is read by the ODE server to - * characterize the process. When SCA interacts with ODE at later points - either when a - * service is being invoked or the process invokes a reference - it is the service @name - * attribute that identifies the service or reference involved. - * - * @version - */ -public class BPELODEDeployFile { - private final Log __log = LogFactory.getLog(getClass()); - - static final String DEPLOY_ELEMENT_START = ""; - static final String PROCESS_ENDELEMENT = ""; - static final String ACTIVE_ELEMENT = "true"; - static final String PROVIDE_ELEMENT_START = ""; - static final String PROVIDE_ENDELEMENT = ""; - static final String SERVICE_ELEMENT_START = ""; - static final String INVOKE_ELEMENT_START = ""; - static final String INVOKE_ENDELEMENT = ""; - - static final String DEPLOY_FILENAME = "deploy.xml"; - - private BPELImplementation implementation; - - /** - * Constructor - requires a BPELImplementation as a parameter - * The ODE deploy.xml file is for this supplied BPELImplementation - * @param theImplementation - */ - public BPELODEDeployFile( BPELImplementation theImplementation ) { - - implementation = theImplementation; - - } // end BPELODEDeployFile constructor - - /** - * Writes the deploy file into the same directory as the BPEL process file, with the name - * "deploy.xml" - */ - public void writeDeployfile() throws IOException { - - File theDirectory = getDirectory(); - - File deployFile = new File( theDirectory, DEPLOY_FILENAME ); - new FileOutputStream( deployFile ); - //if( !deployFile.canWrite() ) throw new IOException( "Unable to write to deploy file" + - // deployFile.getPath() ); - - // Create a stream for the data and write the data to the file - PrintStream theStream = new PrintStream( new FileOutputStream( deployFile ) ); - try { - constructDeployXML( theStream ); - if( theStream.checkError() ) throw new IOException(); - } catch (Exception e) { - throw new IOException( "Unable to write data to deploy file" + - deployFile.getPath() ); - } finally { - theStream.close(); - } // end try - - } // end writeDeployFile - - /** - * Creates the deploy.xml data and writes it to a supplied PrintStream - * @param stream - */ - public void constructDeployXML( PrintStream stream ) { - - // " ); - - // element - stream.println( PROCESS_ELEMENT_START + process.getLocalPart() + - PROCESS_ELEMENT_END ); - - // element - stream.println( ACTIVE_ELEMENT ); - - ComponentType componentType = implementation.getComponentType(); - List theServices = componentType.getServices(); - // Loop over the elements - one per service - for ( Service service : theServices ) { - String serviceName = service.getName(); - // Provide element... - stream.println( PROVIDE_ELEMENT_START + serviceName + PROVIDE_ELEMENT_END ); - // Child service element... - stream.println( SERVICE_ELEMENT_START + serviceName + - SERVICE_ELEMENT_PORT + serviceName + SERVICE_ELEMENT_END ); - stream.println( PROVIDE_ENDELEMENT ); - } // end for - - // Loop over the elements - one per reference - List theReferences = componentType.getReferences(); - for ( Reference reference : theReferences ) { - String referenceName = reference.getName(); - stream.println( INVOKE_ELEMENT_START + referenceName + INVOKE_ELEMENT_END ); - // Child service element... - stream.println( SERVICE_ELEMENT_START + referenceName + - SERVICE_ELEMENT_PORT + referenceName + SERVICE_ELEMENT_END ); - stream.println( INVOKE_ENDELEMENT ); - - } // end for - - // element - stream.println( PROCESS_ENDELEMENT ); - - // - stream.println( DEPLOY_ENDELEMENT ); - - } // end constructDeployXML - - /** - * Gets the directory containing the BPEL process - * @return - */ - private File getDirectory() { - File theDir = getBPELFile().getParentFile(); - return theDir; - } // end getDirectory - - /** - * Gets the File containing the BPEL process definition - * @return - the File object containing the BPEL process - */ - private File getBPELFile() { - try { - String location = this.implementation.getProcessDefinition().getLocation(); - URI locationURI = new URI(null, location, null); - File theProcess = new File(locationURI); - return theProcess; - } catch( Exception e ) { - if(__log.isDebugEnabled()) { - __log.debug("Exception converting BPEL file URL to an URI: " + e ); - } - } // end try - return null; - } // end getBPELFile - - - -} // end class BPELODEDeployFile diff --git a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java deleted file mode 100644 index 619643eaa3..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java +++ /dev/null @@ -1,266 +0,0 @@ -/* - * 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.URISyntaxException; -import java.net.URL; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.ConcurrentHashMap; -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.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.scheduler.simple.JdbcDelegate; -import org.apache.ode.scheduler.simple.SimpleScheduler; -import org.apache.ode.utils.GUID; -import org.apache.tuscany.sca.implementation.bpel.BPELImplementation; -import org.apache.tuscany.sca.runtime.RuntimeComponent; - -/** - * 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; - - private Scheduler _scheduler; - - protected ExecutorService _executorService; - - private Map tuscanyRuntimeComponents = new ConcurrentHashMap(); - - public EmbeddedODEServer(TransactionManager txMgr) { - _txMgr = txMgr; - } - - public void init() throws ODEInitializationException { - Properties p = System.getProperties(); - p.put("derby.system.home", "target"); - - Properties confProps = new Properties(); - confProps.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=false)"); - _config = new OdeConfigProperties(confProps, "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"); - try { - _workRoot = new File(dbLocation.toURI()).getParentFile(); - } catch (URISyntaxException e) { - throw new ODEInitializationException(e); - } - - 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"); - } - - //FIXME: externalize the configuration for ThreadPoolMaxSize - _executorService = Executors.newCachedThreadPool(); - - _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()); - _bpelServer.setScheduler(_scheduler); - if (_config.isDehydrationEnabled()) { - CountLRUDehydrationPolicy dehy = new CountLRUDehydrationPolicy(); - _bpelServer.setDehydrationPolicy(dehy); - } - - _bpelServer.init(); - } // end InitBpelServer - - public void stop() throws ODEShutdownException { - if(_bpelServer != null) { - try { - __log.debug("Stopping BPEL Embedded server"); - _bpelServer.shutdown(); - _bpelServer = null; - } catch (Exception ex) { - __log.debug("Error stopping BPEL server"); - } - } - - if(_scheduler != null) { - try { - __log.debug("Stopping scheduler"); - _scheduler.shutdown(); - _scheduler = null; - } catch (Exception ex) { - __log.debug("Error stopping scheduler"); - } - } - - if(_daoCF != null) { - try { - __log.debug("Stopping DAO"); - _daoCF.shutdown(); - _daoCF = null; - } catch (Exception ex) { - __log.debug("Error stopping DAO"); - } - } - - if(_db != null) { - try { - __log.debug("Stopping DB"); - _db.shutdown(); - _db = null; - } catch (Exception ex) { - __log.debug("Error stopping DB"); - } - } - - if(_txMgr != null) { - try { - __log.debug("Stopping Transaction Manager"); - _txMgr = null; - } catch (Exception ex) { - __log.debug("Error stopping Transaction Manager"); - } - } - } - - 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 ExecutorService getExecutor() { - return _executorService; - } - - // Updated by Mike Edwards, 23/05/2008 - public void deploy(ODEDeployment d, BPELImplementation implementation) { - try { - TuscanyProcessConfImpl processConf = new TuscanyProcessConfImpl( implementation ); - _bpelServer.register(processConf); - __log.debug("Completed calling new Process deployment code..."); - } catch (Exception ex) { - String errMsg = ">>> DEPLOY: Unexpected exception: " + ex.getMessage(); - __log.debug(errMsg, ex); - throw new ODEDeploymentException(errMsg,ex); - } - } - - public void undeploy(ODEDeployment d) { - //TODO - } - - public void registerTuscanyRuntimeComponent(QName processName,RuntimeComponent componentContext) { - tuscanyRuntimeComponents.put(processName, componentContext); - } - - public RuntimeComponent getTuscanyRuntimeComponent(QName processName) { - return tuscanyRuntimeComponents.get(processName); - } -} diff --git a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java deleted file mode 100644 index 11af0f8b50..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 javax.transaction.TransactionManager; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Geronimo transaction factory - * - * @version $Rev$ $Date$ - */ -public class GeronimoTxFactory { - private static final Log __log = LogFactory.getLog(GeronimoTxFactory.class); - - /* Public no-arg constructor 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/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java deleted file mode 100644 index 3f2db7b244..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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 javax.wsdl.PortType; -import javax.xml.namespace.QName; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.ode.bpel.iapi.BindingContext; -import org.apache.ode.bpel.iapi.Endpoint; -import org.apache.ode.bpel.iapi.EndpointReference; -import org.apache.ode.bpel.iapi.PartnerRoleChannel; - -/** - * Binding Context information - * - * @version $Rev$ $Date$ - */ -public class ODEBindingContext implements BindingContext { - protected final Log __log = LogFactory.getLog(getClass()); - - public ODEBindingContext() { - - } - - public EndpointReference activateMyRoleEndpoint(QName pid, Endpoint endpoint) { - // This will be needed when we support callBacks - if (__log.isDebugEnabled()) { - __log.debug("Activating MyRole Endpoint : " + pid + " - " + endpoint.serviceName); - } - - QName processName = getProcessName(pid); - - return new TuscanyEPR(processName, endpoint); - } - - public void deactivateMyRoleEndpoint(Endpoint endpoint) { - if (__log.isDebugEnabled()) { - __log.debug("Deactivate MyRole Endpoint : " + endpoint.serviceName); - } - - } - - public PartnerRoleChannel createPartnerRoleChannel(QName pid, PortType portType, Endpoint endpoint) { - if (__log.isDebugEnabled()) { - __log.debug("Create PartnerRole channel : " + pid + " - " + portType.getQName() + " - "+ endpoint.serviceName); - } - - QName processName = getProcessName(pid); - return new TuscanyPRC(processName, pid, portType, endpoint); - } - - /** - * Helper method to retrieve the BPEL process name from a processID (where processID have version concatenated to it) - * @param pid - * @return QName the BPEL process name - */ - private static QName getProcessName(QName pid) { - String processName = pid.getLocalPart().substring(0, pid.getLocalPart().lastIndexOf("-")); - return new QName(pid.getNamespaceURI(), processName); - } -} diff --git a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java deleted file mode 100644 index d57471e215..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 artifacts. */ - 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; - } - - @Override - public String toString() { - return "Deployment#" + deployDir; - } -} \ No newline at end of file diff --git a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.java deleted file mode 100644 index b03f69d9aa..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 ODEDeploymentException extends RuntimeException { - private static final long serialVersionUID = -2869674556330744215L; - - public ODEDeploymentException(Throwable cause) { - super(cause); - } - - public ODEDeploymentException(String message) { - super(message); - } - - public ODEDeploymentException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java deleted file mode 100644 index 15e9229601..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java +++ /dev/null @@ -1,285 +0,0 @@ -/* - * 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.util.concurrent.Callable; - -import javax.wsdl.Part; -import javax.xml.namespace.QName; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.ode.bpel.iapi.Message; -import org.apache.ode.bpel.iapi.MessageExchange; -import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange; -import org.apache.ode.bpel.iapi.Scheduler; -import org.apache.ode.utils.DOMUtils; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; -import org.apache.tuscany.sca.runtime.RuntimeWire; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * Helper Class to handle invocation to Tuscany Component References - * - * @version $Rev$ $Date$ - */ -public class ODEExternalService { - protected final Log __log = LogFactory.getLog(getClass()); - - private EmbeddedODEServer _server; - private Scheduler _sched; - - public ODEExternalService(EmbeddedODEServer server) { - this._server = server; - this._sched = _server.getScheduler(); - } - - - public void invoke(final PartnerRoleMessageExchange partnerRoleMessageExchange) { - boolean isTwoWay = - partnerRoleMessageExchange.getMessageExchangePattern() == org.apache.ode.bpel.iapi.MessageExchange.MessageExchangePattern.REQUEST_RESPONSE; - - if (isTwoWay) { - // Defer the invoke until the transaction commits. - _sched.registerSynchronizer(new Scheduler.Synchronizer() { - public void beforeCompletion() { - - } - - public void afterCompletion(boolean success) { - // If the TX is rolled back, then we don't send the request. - if (!success) - return; - - // The invocation must happen in a separate thread, holding - // on the afterCompletion - // blocks other operations that could have been listed there - // as well. - _server.getExecutor().submit(new Callable() { - public Object call() throws Exception { - try { - // do execution - if(! (partnerRoleMessageExchange.getChannel() instanceof TuscanyPRC)) { - throw new IllegalArgumentException("Channel should be an instance of TuscanyPRC"); - } - - TuscanyPRC channel = (TuscanyPRC) partnerRoleMessageExchange.getChannel(); - RuntimeComponent tuscanyRuntimeComponent = _server.getTuscanyRuntimeComponent(channel.getProcessName()); - - RuntimeComponentReference runtimeComponentReference = - (RuntimeComponentReference)tuscanyRuntimeComponent.getReferences().get(0); - RuntimeWire runtimeWire = - runtimeComponentReference.getRuntimeWire(runtimeComponentReference.getBindings().get(0)); - - // convert operations - Operation operation = - findOperation(partnerRoleMessageExchange.getOperation().getName(), runtimeComponentReference); - - - /* - This is how a request looks like (payload is wrapped with extra info) - - - - - Luciano - - - - */ - Element msg = partnerRoleMessageExchange.getRequest().getMessage(); - if (msg != null) { - String xml = DOMUtils.domToString(msg); - - String payload = - DOMUtils.domToString(getPayload(partnerRoleMessageExchange.getRequest())); - - if(__log.isDebugEnabled()) { - __log.debug("Starting invocation of SCA Reference"); - __log.debug(">>> Original message: " + xml); - __log.debug(">>> Payload: " + payload); - } - - Object[] args = new Object[] {getPayload(partnerRoleMessageExchange.getRequest())}; - - Object result = null; - boolean success = false; - - try { - result = runtimeWire.invoke(operation, args); - success = true; - } catch (Exception e) { - partnerRoleMessageExchange.replyWithFailure(MessageExchange.FailureType.OTHER, - e.getMessage(), - null); - } - - - if(__log.isDebugEnabled()) { - __log.debug("SCA Reference invocation finished"); - __log.debug(">>> Result : " + DOMUtils.domToString((Element)result)); - } - - if (!success) { - return null; - } - - // two way invocation - // process results based on type of message - // invocation - - // Message response = - // createResponseMessage(partnerRoleMessageExchange, - // (Element) result); - // partnerRoleMessageExchange.reply(response); - replyTwoWayInvocation(partnerRoleMessageExchange.getMessageExchangeId(), - operation, - (Element)result); - } - - } catch (Throwable t) { - // some error - String errmsg = - "Error sending message (mex=" + partnerRoleMessageExchange + "): " + t.getMessage(); - __log.error(errmsg, t); - /*replyWithFailure(partnerRoleMessageExchange.getMessageExchangeId(), - MessageExchange.FailureType.COMMUNICATION_ERROR, - errmsg, - null);*/ - } - return null; - } - }); - - } - }); - partnerRoleMessageExchange.replyAsync(); - - } else { - /** one-way case * */ - _server.getExecutor().submit(new Callable() { - public Object call() throws Exception { - // do reply - // operationClient.execute(false); - return null; - } - }); - partnerRoleMessageExchange.replyOneWayOk(); - } - } - - - /** - * Find the SCA Reference operation - * - * @param operationName - * @param runtimeComponentReference - * @return - */ - private Operation findOperation(String operationName, RuntimeComponentReference runtimeComponentReference) { - Operation reseultOperation = null; - - for(Operation operation : runtimeComponentReference.getInterfaceContract().getInterface().getOperations()) { - if (operationName.equalsIgnoreCase(operation.getName())) { - reseultOperation = operation; - break; - } - } - return reseultOperation; - } - - /** - * Get paylod from a given ODEMessage - * @param odeMessage - * @return - */ - private Element getPayload(Message odeMessage) { - Element payload = null; - Element parameters = odeMessage.getPart("parameters"); - - if (parameters != null && parameters.hasChildNodes()) { - payload = (Element)parameters.getFirstChild(); - } - - return payload; - } - - - private void replyTwoWayInvocation(final String odeMexId, final Operation operation, final Element result) { - // ODE MEX needs to be invoked in a TX. - try { - _server.getScheduler().execIsolatedTransaction(new Callable() { - public Void call() throws Exception { - PartnerRoleMessageExchange odeMex = null; - try { - odeMex = (PartnerRoleMessageExchange)_server.getBpelServer().getEngine().getMessageExchange(odeMexId); - if (odeMex != null) { - Message response = createResponseMessage(odeMex, operation, (Element)result); - odeMex.reply(response); - } - } catch (Exception ex) { - String errmsg = "Unable to process response: " + ex.getMessage(); - if (odeMex != null) { - odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, null); - } - } - - return null; - } - }); - } catch (Exception ex) { - ex.printStackTrace(); - } - - } - - private Message createResponseMessage(PartnerRoleMessageExchange partnerRoleMessageExchange, - Operation operation, - Element invocationResult) { - Document dom = DOMUtils.newDocument(); - - String operationName = operation.getName(); - Part bpelOperationOutputPart = - (Part)((WSDLInterface)operation.getInterface()).getPortType().getOperation(operationName, null, null) - .getOutput().getMessage().getParts().values().iterator().next(); - - Element contentMessage = dom.createElement("message"); - Element contentPart = dom.createElement(bpelOperationOutputPart.getName()); - - contentPart.appendChild(dom.importNode(invocationResult, true)); - contentMessage.appendChild(contentPart); - dom.appendChild(contentMessage); - - if(__log.isDebugEnabled()) { - __log.debug("Creating result message:"); - __log.debug(">>>" + DOMUtils.domToString(dom.getDocumentElement())); - } - - QName id = partnerRoleMessageExchange.getOperation().getOutput().getMessage().getQName(); - Message response = partnerRoleMessageExchange.createMessage(id); - response.setMessage(dom.getDocumentElement()); - - return response; - } - -} diff --git a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java deleted file mode 100644 index 2fa91e4e86..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java deleted file mode 100644 index 1ec82390cf..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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 org.apache.ode.bpel.iapi.BpelEngineException; -import org.apache.ode.bpel.iapi.ContextException; -import org.apache.ode.bpel.iapi.MessageExchangeContext; -import org.apache.ode.bpel.iapi.MyRoleMessageExchange; -import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange; - -/** - * Message Exchange Context information - * - * @version $Rev$ $Date$ - */ -public class ODEMessageExchangeContext implements MessageExchangeContext { - private static final Log __log = LogFactory.getLog(ODEMessageExchangeContext.class); - - private EmbeddedODEServer _server; - - public ODEMessageExchangeContext(EmbeddedODEServer _server) { - this._server = _server; - } - - public void invokePartner(PartnerRoleMessageExchange partnerRoleMessageExchange) throws ContextException { - if (__log.isDebugEnabled()) { - __log.debug("Invoking a partner operation: " + partnerRoleMessageExchange.getOperationName()); - } - - ODEExternalService scaService = new ODEExternalService(_server); - scaService.invoke(partnerRoleMessageExchange); - } - - public void onAsyncReply(MyRoleMessageExchange myRoleMessageExchange) throws BpelEngineException { - if (__log.isDebugEnabled()) { - __log.debug("Processing an async reply from service " + myRoleMessageExchange.getServiceName()); - } - } - } diff --git a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java deleted file mode 100644 index a928379ba9..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyEPR.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyEPR.java deleted file mode 100644 index deaeaec040..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyEPR.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 javax.xml.namespace.QName; - -import org.apache.ode.bpel.iapi.Endpoint; -import org.apache.ode.bpel.iapi.EndpointReference; -import org.apache.ode.utils.DOMUtils; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * This should hold something that makes sense for Tuscany so that the - * process has an address that makes sense from the outside world perspective - * - * @version $Rev$ $Date$ - */ -public class TuscanyEPR implements EndpointReference { - private final Document doc = DOMUtils.newDocument(); - - public TuscanyEPR(QName processName, Endpoint endpoint) { - Element serviceref = doc.createElementNS(EndpointReference.SERVICE_REF_QNAME.getNamespaceURI(), - EndpointReference.SERVICE_REF_QNAME.getLocalPart()); - serviceref.setNodeValue(endpoint.serviceName + ":" + endpoint.portName); - doc.appendChild(serviceref); - } - - public Document toXML() { - return doc; - } -} diff --git a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyPRC.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyPRC.java deleted file mode 100644 index b0539970ec..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyPRC.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 javax.wsdl.PortType; -import javax.xml.namespace.QName; - -import org.apache.ode.bpel.iapi.Endpoint; -import org.apache.ode.bpel.iapi.EndpointReference; -import org.apache.ode.bpel.iapi.PartnerRoleChannel; -import org.apache.ode.utils.DOMUtils; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * Tuscany Partner Role Channel for ODE Integration - * - * @version $Rev$ $Date$ - */ -public class TuscanyPRC implements PartnerRoleChannel { - private final QName processName; - - public TuscanyPRC(QName processName, QName pid, PortType portType, Endpoint endpoint){ - this.processName = processName; - } - - public QName getProcessName() { - return this.processName; - } - - public void close() { - - } - - public EndpointReference getInitialEndpointReference() { - final Document doc = DOMUtils.newDocument(); - Element serviceref = doc.createElementNS(EndpointReference.SERVICE_REF_QNAME.getNamespaceURI(), - EndpointReference.SERVICE_REF_QNAME.getLocalPart()); - doc.appendChild(serviceref); - - return new EndpointReference() { - public Document toXML() { - return doc; - } - }; - } - -} diff --git a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java deleted file mode 100644 index 5cc9a350ef..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java +++ /dev/null @@ -1,437 +0,0 @@ -/* - * 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.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.wsdl.Definition; -import javax.xml.namespace.QName; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.ode.bpel.compiler.BpelC; -import org.apache.ode.bpel.evt.BpelEvent.TYPE; -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.Reference; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.implementation.bpel.BPELImplementation; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -/** - * A Tuscany implementation of the ODE Process Conf - * - * @version $Rev$ $Date$ - */ -public class TuscanyProcessConfImpl implements ProcessConf { - private final Log __log = LogFactory.getLog(getClass()); - - private BPELImplementation implementation; - private Map invokeEndpoints = null; - private Map provideEndpoints = null; - private Map properties = null; - private ProcessState processState; - private Date deployDate; - - private final String TUSCANY_NAMESPACE = "http://tuscany.apache.org"; - - /** - * Constructor for the ProcessConf implementation - * @param theImplementation the BPEL implementation for which this is the ProcessConf - */ - public TuscanyProcessConfImpl( BPELImplementation theImplementation ) { - //System.out.println("New TuscanyProcessConfImpl..."); - this.implementation = theImplementation; - - processState = ProcessState.ACTIVE; - deployDate = new Date(); - - // Compile the process - compile( getBPELFile() ); - } // end TuscanyProcessConfImpl constructor - - /** - * Returns the URI for the directory containing the BPEL process - */ - public URI getBaseURI() { - //System.out.println("getBaseURI called"); - File theDir = getDirectory(); - return theDir.toURI(); - } - - /** - * Returns a String containing the (local) name of the file containing the BPEL process - */ - public String getBpelDocument() { - //System.out.println("getBPELDocument called"); - try { - String location = this.implementation.getProcessDefinition().getLocation(); - URI locationURI = new URI(null, location, null); - File processFile = new File(locationURI); - return getRelativePath( getDirectory(), processFile); - } catch (Exception e) { - if(__log.isWarnEnabled()) { - __log.warn("Unable to resolve relative path of BPEL process" + implementation.getProcessDefinition().getLocation(), e ); - } - return null; - } // end try - } // end getBpelDocument - - /** - * Returns an InputStream containing the Compiled BPEL Process (CBP) - */ - public InputStream getCBPInputStream() { - //System.out.println("getCBPInputStream called"); - // Find the CBP file - it has the same name as the BPEL process and lives in the same - // directory as the process file - String cbpFileName = null; - try { - String fileName = getRelativePath( getDirectory(), getBPELFile() ); - cbpFileName = fileName.substring(0, fileName.lastIndexOf(".")) + ".cbp"; - } catch (Exception e ) { - // IOException trying to fetch the BPEL file name - if(__log.isDebugEnabled()) { - __log.debug("Unable to calculate the file name for BPEL process: " + - implementation.getProcessDefinition().getName(), e); - return null; - } // end if - } // end try - File cbpFile = new File( getDirectory(), cbpFileName ); - if( cbpFile.exists() ) { - // Create an InputStream from the cbp file... - try { - return new FileInputStream( cbpFile ); - } catch ( Exception e ) { - if(__log.isDebugEnabled()) { - __log.debug("Unable to open the cbp file for BPEL process: " + - implementation.getProcessDefinition().getName(), e); - } - } // end try - } else { - // Cannot find the cbp file - if(__log.isWarnEnabled()){ - __log.warn("Cannot find the cbp file for process: " + - implementation.getProcessDefinition().getName()); - } - } // end if - // TODO - need better exception handling if we can't open the cbp file for any reason - return null; - } // end getCBPInputStream - - /** - * Return the WSDL Definition for a given PortType - * @param portTypeName - the QName of the PortType - */ - public Definition getDefinitionForPortType( QName portTypeName ) { - //System.out.println("getDefinitionForPortType called for portType: " + portTypeName ); - // Find the named PortType in the list of WSDL interfaces associated with this BPEL Process - Collection theInterfaces = implementation.getProcessDefinition().getInterfaces(); - for( WSDLInterface wsdlInterface : theInterfaces ) { - if ( wsdlInterface.getPortType().getQName().equals( portTypeName ) ) { - // Extract and return the Definition associated with the WSDLDefinition... - return wsdlInterface.getWsdlDefinition().getDefinition(); - } // end if - } // end for - return null; - } // end getDefinitionforPortType - - /** - * Returns a WSDL Definition for a given Service QName - * - * 22/05/2008 - it is very unclear what this service QName is really meant to be. - * From the handling of the deploy.xml file by the current ODE code, it seems that the key link - * is from the Service QName to the PartnerLink name (done in the deploy.xml file). - * - * The curious part about this is that the QName for the service is ONLY defined in deploy.xml file - * and does not appear to relate to anything else, except for the QName of the PartnerLink - * - * The PartnerLink name is the same as the name of the SCA service (or reference) which in turn points - * at the PartnerLinkType which in turn points at an (WSDL) interface definition. - */ - public Definition getDefinitionForService(QName serviceQName ) { - //System.out.println("getDefinitionForService called for Service: " + serviceQName ); - if(__log.isDebugEnabled()){ - __log.debug("getDefinitionforService called for service: " + serviceQName ); - } - // TODO Auto-generated method stub - return null; - } - - /** - * Returns the date of deployment of the process - * - for SCA returns the date at which this object was created - */ - public Date getDeployDate() { - //System.out.println("getDeployDate called"); - return deployDate; - } - - /** - * Returns userid of deployer - * - always "SCA Tuscany" for Tuscany... - */ - public String getDeployer() { - //System.out.println("getDeployer called"); - return "SCA Tuscany"; - } // end getDeployer - - /** - * Returns a list of the files in the directory containing the BPEL Process - */ - public List getFiles() { - //System.out.println("getFiles called"); - File theDir = getDirectory(); - List theFiles = Arrays.asList( (File[]) theDir.listFiles() ); - // TODO recurse into subdirectories - return theFiles; - } // end getFiles - - /** - * Returns a Map containing all the "invoke endpoints" - for which read "SCA references" - * The map is keyed by partnerLink name and holds Endpoint objects - * - * TODO deal with service callbacks on bidirectional services - */ - public Map getInvokeEndpoints() { - //System.out.println("getInvokeEndpoints called"); - if( invokeEndpoints == null ) { - invokeEndpoints = new HashMap(); - // Get a collection of the references - List theReferences = implementation.getReferences(); - // Create an endpoint for each reference, using the reference name as the "service" - // name, combined with http://tuscany.apache.org to make a QName - for( Reference reference : theReferences ) { - invokeEndpoints.put( reference.getName(), - new Endpoint( new QName( TUSCANY_NAMESPACE, reference.getName() ), "ReferencePort")); - } // end for - } // end if - return invokeEndpoints; - } // end getInvokeEndpoints - - /** - * Returns the name of the directory containing the BPEL files - */ - public String getPackage() { - //System.out.println("getPackage called"); - File theDir = getDirectory(); - return theDir.getName(); - } // end getPackage - - /** - * Return the BPEL Process ID - which is the Process QName appended "-versionnumber" - */ - public QName getProcessId() { - //System.out.println("getProcessId called"); - QName processType = getType(); - QName processID = new QName( processType.getNamespaceURI(), - processType.getLocalPart() + "-" + getVersion() ); - return processID; - } // end getProcessID - - /** - * TODO - What are properties? - */ - public Map getProperties() { - //System.out.println("getProperties called"); - if ( properties == null ) { - properties = new HashMap(); - } // end if - return properties; - } // end getProperties - - /** - * Returns a Map containing all the "provide endpoints" - for which read "SCA services" - * The map is keyed by partnerLink name and holds Endpoint objects - * - * TODO deal with reference callbacks on bidirectional references - */ - public Map getProvideEndpoints() { - //System.out.println("getProvideEndpoints called"); - if( provideEndpoints == null ) { - provideEndpoints = new HashMap(); - // Get a collection of the references - List theServices = implementation.getServices(); - // Create an endpoint for each reference, using the reference name as the "service" - // name, combined with http://tuscany.apache.org to make a QName - for( Service service : theServices ) { - provideEndpoints.put( service.getName(), - new Endpoint( new QName( TUSCANY_NAMESPACE, service.getName() ), "ServicePort")); - } // end for - } // end if - return provideEndpoints; - } // end getProvideEndpoints - - /** - * Return the process state - */ - public ProcessState getState() { - //System.out.println("getState called"); - return processState; - } - - /** - * Returns the QName of the BPEL process - */ - public QName getType() { - //System.out.println("getType called"); - return implementation.getProcess(); - } - - /** - * Gets the process Version number - * - current code does not have versions for BPEL processes and always returns "1" - */ - public long getVersion() { - //System.out.println("getVersion called"); - return 1; - } - - /** - * Returns true if the supplied event type is enabled for any of the scopes in the provided - * List. These events are "ODE Execution Events" and there is a definition of them on this - * page: http://ode.apache.org/user-guide.html#UserGuide-ProcessDeployment - * - * For the present Tuscany does not support manipulating the event enablement and always - * returns that the event is not enabled - * @param scopeNames - list of BPEL process Scope names - * @param type - the event type - */ - public boolean isEventEnabled(List scopeNames, TYPE type) { - //System.out.println("isEventEnabled called with scopeNames: " + - // scopeNames + " and type: " + type ); - return false; - } // end isEventEnabled - - /** - * Returns whether the process is persisted in the store - * - * Returns false for SCA configuration - * - returning true causes problems in communicating with the BPEL process - */ - public boolean isTransient() { - //System.out.println("isTransient called"); - return false; - } // end isTransient - - /** - * Compiles a BPEL process file into a compiled form CBP file in the main directory - * (ie same directory as the BPEL process file) - * @param bpelFile - the BPEL process file - */ - private void compile( File bpelFile ) { - // Set up the compiler - BpelC compiler = BpelC.newBpelCompiler(); - // Provide a null set of initial properties for now - Map processProps = new HashMap(); - Map compileProps = new HashMap(); - compileProps.put( BpelC.PROCESS_CUSTOM_PROPERTIES, processProps ); - compiler.setCompileProperties( compileProps ); - compiler.setBaseDirectory( getDirectory() ); - - // Run the compiler and generate the CBP file into the given directory - try { - compiler.compile( bpelFile ); - } catch (IOException e) { - if(__log.isDebugEnabled()) { - __log.debug("Compile error in " + bpelFile, e); - } - // TODO - need better exception handling here - } // end try - } // end compile - - /** - * Gets the directory containing the BPEL process - * @return - */ - private File getDirectory() { - File theDir = getBPELFile().getParentFile(); - return theDir; - } // end getDirectory - - /** - * Gets the File containing the BPEL process definition - * @return - the File object containing the BPEL process - */ - private File getBPELFile() { - try { - String location = this.implementation.getProcessDefinition().getLocation(); - URI locationURI = new URI(null, location, null); - File theProcess = new File(locationURI); - return theProcess; - } catch( Exception e ) { - if(__log.isDebugEnabled()) { - __log.debug("Exception converting BPEL file URL to an URI: " + e ); - } - } // end try - return null; - } // end getBPELFile - - /** - * Gets the relative path of a file against a directory in its hierarchy - * @param base - the base directory - * @param path - the file - * @return - * @throws IOException - */ - private String getRelativePath(File base, File path) throws IOException { - String basePath = base.getCanonicalPath(); - String filePath = path.getCanonicalPath(); - if (!filePath.startsWith(basePath)) { - throw new IOException("Invalid relative path: base=" + base + " path=" + path); - } - String relative = filePath.substring(basePath.length()); - if (relative.startsWith(File.separator)) { - relative = relative.substring(1); - } - return relative; - } // end getRelativePath - - //----------------------------------------------------------------------------- - // other public APIs which ProcessConfImpl displays which are not in ProcessConf interface - - public List getMexInterceptors(QName processId) { -// System.out.println("getMexInterceptors for processID: " + processId ); - return null; - } - - public void setTransient(boolean t) { -// System.out.println("setTransient called with boolean: " + t ); - } - - public List getExtensionElement(QName arg0) { - return Collections.emptyList(); - } - // end of other public APIs - //----------------------------------------------------------------------------- - -} // end class TuscanyProcessConfImpl diff --git a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java deleted file mode 100644 index c500f001dc..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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.provider; - -import java.io.File; -import java.net.URI; - -import javax.transaction.TransactionManager; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.databinding.xml.DOMDataBinding; -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; - -/** - * BPEL Implementation provider - * - * @version $Rev$ $Date$ - */ -public class BPELImplementationProvider implements ImplementationProvider { - private final Log __log = LogFactory.getLog(getClass()); - - private RuntimeComponent component; - private BPELImplementation implementation; - - private EmbeddedODEServer odeServer; - private TransactionManager txMgr; - - /** - * 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; - - // Configure the service and reference interfaces to use a DOM databinding - // as it's what ODE expects - for (Service service: implementation.getServices()) { - service.getInterfaceContract().getInterface().resetDataBinding(DOMDataBinding.NAME); - } - for (Reference reference: implementation.getReferences()) { - reference.getInterfaceContract().getInterface().resetDataBinding(DOMDataBinding.NAME); - } - - } - - public Invoker createInvoker(RuntimeComponentService service, Operation operation) { - BPELInvoker invoker = new BPELInvoker(component, service, operation, odeServer, txMgr); - return invoker; - } - - public boolean supportsOneWayInvocation() { - return false; - } - - public void start() { - if(__log.isInfoEnabled()) { - __log.info("Starting " + component.getName()); - } - - try { - if (!odeServer.isInitialized()) { - // start ode server - odeServer.init(); - } - - String location = this.implementation.getProcessDefinition().getLocation(); - URI deployURI = new URI(null, location, null); - - File deploymentDir = new File(deployURI).getParentFile(); - - if(__log.isInfoEnabled()) { - __log.info(">>> Deploying : " + deploymentDir.toString()); - } - - // deploy the process - if (odeServer.isInitialized()) { - try { - //txMgr.begin(); - odeServer.registerTuscanyRuntimeComponent(implementation.getProcess(), component); - // Replaced by Mike Edwards 23/05/2008 - //odeServer.deploy(new ODEDeployment(deploymentDir)); - odeServer.deploy(new ODEDeployment(deploymentDir), implementation ); - //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); - } - } - - public void stop() { - if(__log.isInfoEnabled()) { - __log.info("Stopping " + component.getName()); - } - - if (odeServer.isInitialized()) { - // start ode server - odeServer.stop(); - } - - txMgr = null; - - if(__log.isInfoEnabled()) { - __log.info("Stopped !!!"); - } - } - -} diff --git a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProviderFactory.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProviderFactory.java deleted file mode 100644 index ed327e237b..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProviderFactory.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.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; -import org.oasisopen.sca.annotation.Destroy; - -/** - * BPEL Implementation provider factory - * - * We use the provider factory to instantiate a ODE server that is going to be injected in all BPEL components - * - * @version $Rev$ $Date$ - */ -public class BPELImplementationProviderFactory implements ImplementationProviderFactory { - - 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 getModelType() { - return BPELImplementation.class; - } - - @Destroy - public void destroy() { - txMgr = null; - } -} diff --git a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java b/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java deleted file mode 100644 index e07fdbc302..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * 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.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.xml.namespace.QName; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -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.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; -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. - * - * @version $Rev$ $Date$ - */ -public class BPELInvoker implements Invoker { - protected final Log __log = LogFactory.getLog(getClass()); - - private EmbeddedODEServer odeServer; - private TransactionManager txMgr; - - private RuntimeComponentService service; - private Operation operation; - private QName bpelServiceName; - private String bpelOperationName; - private Part bpelOperationInputPart; - private Part bpelOperationOutputPart; - - public BPELInvoker(RuntimeComponent component, RuntimeComponentService service, Operation operation, EmbeddedODEServer odeServer, TransactionManager txMgr) { - this.service = service; - this.operation = operation; - this.bpelOperationName = operation.getName(); - this.odeServer = odeServer; - this.txMgr = txMgr; - - initializeInvocation(); - } - - - private void initializeInvocation() { - - __log.debug("Initializing BPELInvoker"); - - Interface interfaze = operation.getInterface(); - if(interfaze instanceof WSDLInterface){ - WSDLInterface wsdlInterface = null; - wsdlInterface = (WSDLInterface) interfaze; - - // The following commented out code is bogus and is replaced by what follows - Mike Edwards - // Service serviceDefinition = (Service) wsdlInterface.getWsdlDefinition().getDefinition().getAllServices().values().iterator().next(); - // bpelServiceName = serviceDefinition.getQName(); - // - // Fetch the service name from the service object - bpelServiceName = new QName( "http://tuscany.apache.org", service.getName() ); - - 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()); - - if (__log.isDebugEnabled()) { - Status status = mex.getStatus(); - Element invocationResponse = mex.getResponse().getMessage(); - __log.debug(">>>Invocation status:" + status.name()); - __log.debug(">>>Response:\n" + DOMUtils.domToString(invocationResponse)); - __log.debug(">>>Response:\n" + DOMUtils.domToString(invocationResponse)); - } - - //process the method invocation result - response = processResponse(mex.getResponse().getMessage()); - - 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 : - * - * - * Hello - * - * - * @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 payload = null; - - //TUSCANY-2321 - Properly handling Document or Element types - if(args[0] instanceof Document) { - payload = (Element) ((Document) args[0]).getFirstChild(); - } else { - payload = (Element) args[0]; - } - - contentPart.appendChild(dom.importNode(payload, true)); - contentMessage.appendChild(contentPart); - dom.appendChild(contentMessage); - - if (__log.isDebugEnabled()) { - __log.debug("Creating invocation message:"); - __log.debug(">> args.....: " + DOMUtils.domToString(payload)); - __log.debug(">> 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 - * - * - * - * World - * - * - * - * @param response - * @return - */ - private Element processResponse(Element response) { - return (Element) DOMUtils.findChildByName(response, new QName("",bpelOperationOutputPart.getName())); - } -} diff --git a/java/sca/modules/implementation-bpel-ode/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/java/sca/modules/implementation-bpel-ode/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory deleted file mode 100644 index 3bce8aa9ab..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory +++ /dev/null @@ -1,19 +0,0 @@ -# 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.ode.provider.BPELImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.bpel.BPELImplementation diff --git a/java/sca/modules/implementation-bpel-ode/src/test/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServerTestCase.java b/java/sca/modules/implementation-bpel-ode/src/test/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServerTestCase.java deleted file mode 100644 index 0f59990377..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/test/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServerTestCase.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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 javax.transaction.TransactionManager; - -import junit.framework.TestCase; - -/** - * Test to Deploy and Invoke a HelloWorld BPEL process using EmbeddedODEServer - * - * Major changes introduced to this testcase on 27/05/2008 associated with changes in the - * implementation of EmbeddedODEServer which remove the need for the ODE deploy.xml file - - * instead a Tuscany BPELImplementation object is passed to the EmbeddedODEServer and this is - * introspected to get all the necessary information about the BPEL process - * - * @version $Rev$ $Date$ - */ -public class EmbeddedODEServerTestCase extends TestCase { - - private EmbeddedODEServer odeServer; - - private TransactionManager txMgr; - - @Override - protected void setUp() throws Exception { - // Set up the ODE BPEL server... - GeronimoTxFactory txFactory = new GeronimoTxFactory(); - txMgr = txFactory.getTransactionManager(); - - this.odeServer = new EmbeddedODEServer(txMgr); - odeServer.init(); - - } // end setUp - - @Override - protected void tearDown() throws Exception { - odeServer.stop(); - } - - public void testProcessInvocation() throws Exception { - if (!odeServer.isInitialized()) { - fail("Server did not start !"); - } -// TODO - write effective testcase - made problematic by the need to supply a resolved -// BPELImplementation -/* - URL deployURL = getClass().getClassLoader().getResource("helloworld/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), implementation); - 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("Hello")); - 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(); - } // end try - } // end if -*/ - } // end testProcessInvocation - -} diff --git a/java/sca/modules/implementation-bpel-ode/src/test/resources/helloworld/deploy.xml b/java/sca/modules/implementation-bpel-ode/src/test/resources/helloworld/deploy.xml deleted file mode 100644 index 571aa37d58..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/test/resources/helloworld/deploy.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - true - - - - - diff --git a/java/sca/modules/implementation-bpel-ode/src/test/resources/helloworld/greetings.wsdl b/java/sca/modules/implementation-bpel-ode/src/test/resources/helloworld/greetings.wsdl deleted file mode 100644 index bcd3ea6afa..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/test/resources/helloworld/greetings.wsdl +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/modules/implementation-bpel-ode/src/test/resources/helloworld/helloworld.bpel b/java/sca/modules/implementation-bpel-ode/src/test/resources/helloworld/helloworld.bpel deleted file mode 100644 index 8cf91adc2c..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/test/resources/helloworld/helloworld.bpel +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - concat($tmpVar,' World') - - - - - - diff --git a/java/sca/modules/implementation-bpel-ode/src/test/resources/helloworld/helloworld.wsdl b/java/sca/modules/implementation-bpel-ode/src/test/resources/helloworld/helloworld.wsdl deleted file mode 100644 index 1d71727b2d..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/test/resources/helloworld/helloworld.wsdl +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/modules/implementation-bpel-ode/src/test/resources/log4j.properties b/java/sca/modules/implementation-bpel-ode/src/test/resources/log4j.properties deleted file mode 100644 index 82b3c09723..0000000000 --- a/java/sca/modules/implementation-bpel-ode/src/test/resources/log4j.properties +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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=OFF, CONSOLE - -# log4j properties to work with commandline tools. -log4j.category.org.mortbay=OFF -log4j.category.org.hibernate.type=OFF -log4j.category.org.objectweb=OFF -log4j.category.org.apache.ode.axis2=OFF -log4j.category.org.apache.ode.bpel.engine=OFF -log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF -log4j.category.org.apache.ode.bpel.epr=OFF -log4j.category.org.apache.tuscany.sca.implementation.bpel=OFF -log4j.category.org.apache.tuscany.sca.implementation.bpel.ode=OFF -log4j.category.org.apache.tuscany.sca.implementation.bpel.ode.provider=OFF - -# 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 diff --git a/java/sca/modules/implementation-bpel-runtime/LICENSE b/java/sca/modules/implementation-bpel-runtime/LICENSE new file mode 100644 index 0000000000..baba9ca048 --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/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/java/sca/modules/implementation-bpel-runtime/META-INF/MANIFEST.MF b/java/sca/modules/implementation-bpel-runtime/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..5e8ef59631 --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/META-INF/MANIFEST.MF @@ -0,0 +1,46 @@ +Manifest-Version: 1.0 +Private-Package: org.apache.tuscany.sca.implementation.bpel.ode;versio + n="2.0",org.apache.tuscany.sca.implementation.bpel.ode.provider;versi + on="2.0" +Tool: Bnd-0.0.255 +Bundle-Name: Apache Tuscany SCA BPEL ODE Implementation Extension +Created-By: 1.6.0_07 (Sun Microsystems Inc.) +Bundle-Vendor: The Apache Software Foundation +Bundle-Version: 2.0 +Bnd-LastModified: 1225397447609 +Bundle-ManifestVersion: 2 +Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt +Bundle-Description: Apache Tuscany SCA BPEL ODE Implementation Extensi + on +Import-Package: javax.resource.spi, + javax.sql, + javax.transaction;version="1.1.0", + javax.wsdl, + javax.xml.namespace, + org.apache.commons.logging, + org.apache.geronimo.transaction.manager, + org.apache.ode.bpel.compiler, + org.apache.ode.bpel.dao, + org.apache.ode.bpel.engine, + org.apache.ode.bpel.evt, + org.apache.ode.bpel.iapi, + org.apache.ode.bpel.memdao, + org.apache.ode.il.config, + org.apache.ode.il.dbutil, + org.apache.ode.scheduler.simple, + org.apache.ode.utils, + org.apache.tuscany.sca.assembly;version="2.0", + org.apache.tuscany.sca.core;version="2.0", + org.apache.tuscany.sca.databinding.xml;version="2.0", + org.apache.tuscany.sca.implementation.bpel;version="2.0", + org.apache.tuscany.sca.interfacedef;version="2.0", + org.apache.tuscany.sca.interfacedef.wsdl;version="2.0", + org.apache.tuscany.sca.invocation;version="2.0", + org.apache.tuscany.sca.policy;version="2.0.0", + org.apache.tuscany.sca.provider;version="2.0", + org.apache.tuscany.sca.runtime;version="2.0", + org.oasisopen.sca.annotation;version="2.0", + org.w3c.dom +Bundle-SymbolicName: org.apache.tuscany.sca.implementation.bpel.ode +Bundle-DocURL: http://www.apache.org/ +Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6 diff --git a/java/sca/modules/implementation-bpel-runtime/NOTICE b/java/sca/modules/implementation-bpel-runtime/NOTICE new file mode 100644 index 0000000000..a2f696be26 --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/NOTICE @@ -0,0 +1,17 @@ +${pom.name} +Copyright (c) 2005 - 2008 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/java/sca/modules/implementation-bpel-runtime/pom.xml b/java/sca/modules/implementation-bpel-runtime/pom.xml new file mode 100644 index 0000000000..abd52be4d2 --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/pom.xml @@ -0,0 +1,446 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-modules + 2.0-SNAPSHOT + ../pom.xml + + tuscany-implementation-bpel-runtime + Apache Tuscany SCA BPEL ODE Implementation Extension + + + org.apache.tuscany.sca + tuscany-assembly + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-implementation-bpel + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-core + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-interface + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-assembly-xml + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-contribution + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-databinding + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-interface-wsdl + 2.0-SNAPSHOT + + + + + org.apache.ode + ode-bpel-epr + 1.1.1 + + + org.apache.ode + ode-bpel-store + 1.1.1 + + + org.apache.ode + ode-bpel-dao + 1.1.1 + + + org.apache.ode + ode-bpel-dao + 1.1.1 + + + org.apache.ode + ode-dao-jpa + 1.1.1 + + + org.apache.ode + ode-dao-jpa-ojpa-derby + 1.1.1 + zip + + + org.apache.ode + ode-bpel-runtime + 1.1.1 + + + org.apache.ode + ode-bpel-api + 1.1.1 + + + org.apache.ode + ode-scheduler-simple + 1.1.1 + + + org.apache.ode + ode-utils + 1.1.1 + + + org.apache.ode + ode-bpel-compiler + 1.1.1 + + + org.apache.ode + ode-bpel-schemas + 1.1.1 + + + org.apache.ode + ode-bpel-obj + 1.1.1 + + + org.apache.ode + ode-jacob + 1.1.1 + + + org.apache.ode + ode-jacob-ap + 1.1.1 + + + + + commons-lang + commons-lang + 2.1 + + + commons-collections + commons-collections + 3.1 + + + org.apache.geronimo.specs + geronimo-jta_1.1_spec + 1.1.1 + + + org.apache.geronimo.modules + geronimo-kernel + 1.2-beta + + + mx4j + mx4j + + + cglib + cglib-nodep + + + xpp3 + xpp3 + + + xstream + xstream + + + + + org.apache.geronimo.modules + geronimo-transaction + 1.2-beta + + + org.apache.geronimo.specs + geronimo-jta_1.0.1B_spec + + + org.apache.geronimo.specs + geronimo-ejb_2.1_spec + + + ognl + ognl + + + junit + junit + + + + + org.apache.geronimo.specs + geronimo-ejb_3.0_spec + 1.0 + + + org.apache.geronimo.modules + geronimo-connector + 1.2-beta + + + org.apache.geronimo.specs + geronimo-jta_1.0.1B_spec + + + xmlbeans + xbean + + + stax + stax-api + + + + + org.apache.derby + derby + 10.3.1.4 + + + tranql + tranql-connector + 1.1 + + + geronimo-spec + geronimo-spec-jta + + + junit + junit + + + + + org.apache.openjpa + openjpa-all + 0.9.7-incubating + + + org.apache.openjpa + openjpa-lib + + + org.apache.openjpa + openjpa-kernel + + + org.apache.openjpa + openjpa-kernel-5 + + + org.apache.openjpa + openjpa-jdbc + + + org.apache.openjpa + openjpa-jdbc-5 + + + org.apache.openjpa + openjpa-persistence-jdbc + + + org.apache.openjpa + openjpa-xmlstore + + + junit + junit + + + + + net.sourceforge.serp + serp + 1.12.0 + + + junit + junit + + + + + jaxen + jaxen + 1.1.1 + + + xom + xom + + + xml-apis + xml-apis + + + + + xalan + xalan + 2.7.0 + + + xml-apis + xml-apis + + + + + xerces + xercesImpl + 2.8.1 + + + xml-apis + xml-apis + + + + + org.apache.xmlbeans + xmlbeans + 2.3.0 + + + stax + stax-api + + + + + net.sf.saxon + saxon + 8.7 + + + + net.sf.saxon + saxon-dom + 8.7 + + + + net.sf.saxon + saxon-xpath + 8.7 + + + commons-codec + commons-codec + 1.3 + + + commons-codec + commons-codec + + + + + log4j + log4j + 1.2.13 + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + 2.3.1 + + false + false + true + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + generate-sources + + unpack + + + + + org.apache.ode + ode-dao-jpa-ojpa-derby + 1.1.1 + zip + true + ${project.build.directory}/test-classes/ + + + + + + + + + + + diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/BPELODEDeployFile.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/BPELODEDeployFile.java new file mode 100644 index 0000000000..5ad8b7c5d9 --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/BPELODEDeployFile.java @@ -0,0 +1,227 @@ +/* + * 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.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.net.URI; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.tuscany.sca.assembly.ComponentType; +import org.apache.tuscany.sca.assembly.Reference; +import org.apache.tuscany.sca.assembly.Service; +import org.apache.tuscany.sca.implementation.bpel.BPELImplementation; + +/** + * A class that handles the deploy.xml file required for each BPEL process by the ODE runtime + * @author Mike Edwards + * + * An explanation of the structure of the ODE deploy file: + * + * + * + * + * true + * + * + * + * + * + * + * + * + * + * For SCA purposes: + * + * a) Each partner link in the BPEL process is declared using either a + * (for a service) or using a (for a reference). + * + * b) Each and must use the partnerLink name, as declared in the + * BPEL process. + * + * c) The and elements each have a single child element. + * The elements have name and port attributes. The NAME attribute MUST be set + * to the same name as the partnerLink and MUST be prefixed by a prefix which references + * the namespace "http://tuscany.apache.org" ("tus" in the example above). + * The port attribute can be set to any name (it must be present but it is not actually + * used for anything significant). + * + * When SCA loads a BPEL process to the ODE server, this file is read by the ODE server to + * characterize the process. When SCA interacts with ODE at later points - either when a + * service is being invoked or the process invokes a reference - it is the service @name + * attribute that identifies the service or reference involved. + * + * @version + */ +public class BPELODEDeployFile { + private final Log __log = LogFactory.getLog(getClass()); + + static final String DEPLOY_ELEMENT_START = ""; + static final String PROCESS_ENDELEMENT = ""; + static final String ACTIVE_ELEMENT = "true"; + static final String PROVIDE_ELEMENT_START = ""; + static final String PROVIDE_ENDELEMENT = ""; + static final String SERVICE_ELEMENT_START = ""; + static final String INVOKE_ELEMENT_START = ""; + static final String INVOKE_ENDELEMENT = ""; + + static final String DEPLOY_FILENAME = "deploy.xml"; + + private BPELImplementation implementation; + + /** + * Constructor - requires a BPELImplementation as a parameter + * The ODE deploy.xml file is for this supplied BPELImplementation + * @param theImplementation + */ + public BPELODEDeployFile( BPELImplementation theImplementation ) { + + implementation = theImplementation; + + } // end BPELODEDeployFile constructor + + /** + * Writes the deploy file into the same directory as the BPEL process file, with the name + * "deploy.xml" + */ + public void writeDeployfile() throws IOException { + + File theDirectory = getDirectory(); + + File deployFile = new File( theDirectory, DEPLOY_FILENAME ); + new FileOutputStream( deployFile ); + //if( !deployFile.canWrite() ) throw new IOException( "Unable to write to deploy file" + + // deployFile.getPath() ); + + // Create a stream for the data and write the data to the file + PrintStream theStream = new PrintStream( new FileOutputStream( deployFile ) ); + try { + constructDeployXML( theStream ); + if( theStream.checkError() ) throw new IOException(); + } catch (Exception e) { + throw new IOException( "Unable to write data to deploy file" + + deployFile.getPath() ); + } finally { + theStream.close(); + } // end try + + } // end writeDeployFile + + /** + * Creates the deploy.xml data and writes it to a supplied PrintStream + * @param stream + */ + public void constructDeployXML( PrintStream stream ) { + + // " ); + + // element + stream.println( PROCESS_ELEMENT_START + process.getLocalPart() + + PROCESS_ELEMENT_END ); + + // element + stream.println( ACTIVE_ELEMENT ); + + ComponentType componentType = implementation.getComponentType(); + List theServices = componentType.getServices(); + // Loop over the elements - one per service + for ( Service service : theServices ) { + String serviceName = service.getName(); + // Provide element... + stream.println( PROVIDE_ELEMENT_START + serviceName + PROVIDE_ELEMENT_END ); + // Child service element... + stream.println( SERVICE_ELEMENT_START + serviceName + + SERVICE_ELEMENT_PORT + serviceName + SERVICE_ELEMENT_END ); + stream.println( PROVIDE_ENDELEMENT ); + } // end for + + // Loop over the elements - one per reference + List theReferences = componentType.getReferences(); + for ( Reference reference : theReferences ) { + String referenceName = reference.getName(); + stream.println( INVOKE_ELEMENT_START + referenceName + INVOKE_ELEMENT_END ); + // Child service element... + stream.println( SERVICE_ELEMENT_START + referenceName + + SERVICE_ELEMENT_PORT + referenceName + SERVICE_ELEMENT_END ); + stream.println( INVOKE_ENDELEMENT ); + + } // end for + + // element + stream.println( PROCESS_ENDELEMENT ); + + // + stream.println( DEPLOY_ENDELEMENT ); + + } // end constructDeployXML + + /** + * Gets the directory containing the BPEL process + * @return + */ + private File getDirectory() { + File theDir = getBPELFile().getParentFile(); + return theDir; + } // end getDirectory + + /** + * Gets the File containing the BPEL process definition + * @return - the File object containing the BPEL process + */ + private File getBPELFile() { + try { + String location = this.implementation.getProcessDefinition().getLocation(); + URI locationURI = new URI(null, location, null); + File theProcess = new File(locationURI); + return theProcess; + } catch( Exception e ) { + if(__log.isDebugEnabled()) { + __log.debug("Exception converting BPEL file URL to an URI: " + e ); + } + } // end try + return null; + } // end getBPELFile + + + +} // end class BPELODEDeployFile diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java new file mode 100644 index 0000000000..619643eaa3 --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java @@ -0,0 +1,266 @@ +/* + * 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.URISyntaxException; +import java.net.URL; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.ConcurrentHashMap; +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.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.scheduler.simple.JdbcDelegate; +import org.apache.ode.scheduler.simple.SimpleScheduler; +import org.apache.ode.utils.GUID; +import org.apache.tuscany.sca.implementation.bpel.BPELImplementation; +import org.apache.tuscany.sca.runtime.RuntimeComponent; + +/** + * 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; + + private Scheduler _scheduler; + + protected ExecutorService _executorService; + + private Map tuscanyRuntimeComponents = new ConcurrentHashMap(); + + public EmbeddedODEServer(TransactionManager txMgr) { + _txMgr = txMgr; + } + + public void init() throws ODEInitializationException { + Properties p = System.getProperties(); + p.put("derby.system.home", "target"); + + Properties confProps = new Properties(); + confProps.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=false)"); + _config = new OdeConfigProperties(confProps, "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"); + try { + _workRoot = new File(dbLocation.toURI()).getParentFile(); + } catch (URISyntaxException e) { + throw new ODEInitializationException(e); + } + + 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"); + } + + //FIXME: externalize the configuration for ThreadPoolMaxSize + _executorService = Executors.newCachedThreadPool(); + + _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()); + _bpelServer.setScheduler(_scheduler); + if (_config.isDehydrationEnabled()) { + CountLRUDehydrationPolicy dehy = new CountLRUDehydrationPolicy(); + _bpelServer.setDehydrationPolicy(dehy); + } + + _bpelServer.init(); + } // end InitBpelServer + + public void stop() throws ODEShutdownException { + if(_bpelServer != null) { + try { + __log.debug("Stopping BPEL Embedded server"); + _bpelServer.shutdown(); + _bpelServer = null; + } catch (Exception ex) { + __log.debug("Error stopping BPEL server"); + } + } + + if(_scheduler != null) { + try { + __log.debug("Stopping scheduler"); + _scheduler.shutdown(); + _scheduler = null; + } catch (Exception ex) { + __log.debug("Error stopping scheduler"); + } + } + + if(_daoCF != null) { + try { + __log.debug("Stopping DAO"); + _daoCF.shutdown(); + _daoCF = null; + } catch (Exception ex) { + __log.debug("Error stopping DAO"); + } + } + + if(_db != null) { + try { + __log.debug("Stopping DB"); + _db.shutdown(); + _db = null; + } catch (Exception ex) { + __log.debug("Error stopping DB"); + } + } + + if(_txMgr != null) { + try { + __log.debug("Stopping Transaction Manager"); + _txMgr = null; + } catch (Exception ex) { + __log.debug("Error stopping Transaction Manager"); + } + } + } + + 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 ExecutorService getExecutor() { + return _executorService; + } + + // Updated by Mike Edwards, 23/05/2008 + public void deploy(ODEDeployment d, BPELImplementation implementation) { + try { + TuscanyProcessConfImpl processConf = new TuscanyProcessConfImpl( implementation ); + _bpelServer.register(processConf); + __log.debug("Completed calling new Process deployment code..."); + } catch (Exception ex) { + String errMsg = ">>> DEPLOY: Unexpected exception: " + ex.getMessage(); + __log.debug(errMsg, ex); + throw new ODEDeploymentException(errMsg,ex); + } + } + + public void undeploy(ODEDeployment d) { + //TODO + } + + public void registerTuscanyRuntimeComponent(QName processName,RuntimeComponent componentContext) { + tuscanyRuntimeComponents.put(processName, componentContext); + } + + public RuntimeComponent getTuscanyRuntimeComponent(QName processName) { + return tuscanyRuntimeComponents.get(processName); + } +} diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java new file mode 100644 index 0000000000..11af0f8b50 --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/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 javax.transaction.TransactionManager; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Geronimo transaction factory + * + * @version $Rev$ $Date$ + */ +public class GeronimoTxFactory { + private static final Log __log = LogFactory.getLog(GeronimoTxFactory.class); + + /* Public no-arg constructor 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/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java new file mode 100644 index 0000000000..3f2db7b244 --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java @@ -0,0 +1,79 @@ +/* + * 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 javax.wsdl.PortType; +import javax.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.ode.bpel.iapi.BindingContext; +import org.apache.ode.bpel.iapi.Endpoint; +import org.apache.ode.bpel.iapi.EndpointReference; +import org.apache.ode.bpel.iapi.PartnerRoleChannel; + +/** + * Binding Context information + * + * @version $Rev$ $Date$ + */ +public class ODEBindingContext implements BindingContext { + protected final Log __log = LogFactory.getLog(getClass()); + + public ODEBindingContext() { + + } + + public EndpointReference activateMyRoleEndpoint(QName pid, Endpoint endpoint) { + // This will be needed when we support callBacks + if (__log.isDebugEnabled()) { + __log.debug("Activating MyRole Endpoint : " + pid + " - " + endpoint.serviceName); + } + + QName processName = getProcessName(pid); + + return new TuscanyEPR(processName, endpoint); + } + + public void deactivateMyRoleEndpoint(Endpoint endpoint) { + if (__log.isDebugEnabled()) { + __log.debug("Deactivate MyRole Endpoint : " + endpoint.serviceName); + } + + } + + public PartnerRoleChannel createPartnerRoleChannel(QName pid, PortType portType, Endpoint endpoint) { + if (__log.isDebugEnabled()) { + __log.debug("Create PartnerRole channel : " + pid + " - " + portType.getQName() + " - "+ endpoint.serviceName); + } + + QName processName = getProcessName(pid); + return new TuscanyPRC(processName, pid, portType, endpoint); + } + + /** + * Helper method to retrieve the BPEL process name from a processID (where processID have version concatenated to it) + * @param pid + * @return QName the BPEL process name + */ + private static QName getProcessName(QName pid) { + String processName = pid.getLocalPart().substring(0, pid.getLocalPart().lastIndexOf("-")); + return new QName(pid.getNamespaceURI(), processName); + } +} diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java new file mode 100644 index 0000000000..d57471e215 --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java @@ -0,0 +1,44 @@ +/* + * 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 artifacts. */ + 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; + } + + @Override + public String toString() { + return "Deployment#" + deployDir; + } +} \ No newline at end of file diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.java new file mode 100644 index 0000000000..b03f69d9aa --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.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 ODEDeploymentException extends RuntimeException { + private static final long serialVersionUID = -2869674556330744215L; + + public ODEDeploymentException(Throwable cause) { + super(cause); + } + + public ODEDeploymentException(String message) { + super(message); + } + + public ODEDeploymentException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java new file mode 100644 index 0000000000..15e9229601 --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java @@ -0,0 +1,285 @@ +/* + * 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.util.concurrent.Callable; + +import javax.wsdl.Part; +import javax.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.ode.bpel.iapi.Message; +import org.apache.ode.bpel.iapi.MessageExchange; +import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange; +import org.apache.ode.bpel.iapi.Scheduler; +import org.apache.ode.utils.DOMUtils; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentReference; +import org.apache.tuscany.sca.runtime.RuntimeWire; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * Helper Class to handle invocation to Tuscany Component References + * + * @version $Rev$ $Date$ + */ +public class ODEExternalService { + protected final Log __log = LogFactory.getLog(getClass()); + + private EmbeddedODEServer _server; + private Scheduler _sched; + + public ODEExternalService(EmbeddedODEServer server) { + this._server = server; + this._sched = _server.getScheduler(); + } + + + public void invoke(final PartnerRoleMessageExchange partnerRoleMessageExchange) { + boolean isTwoWay = + partnerRoleMessageExchange.getMessageExchangePattern() == org.apache.ode.bpel.iapi.MessageExchange.MessageExchangePattern.REQUEST_RESPONSE; + + if (isTwoWay) { + // Defer the invoke until the transaction commits. + _sched.registerSynchronizer(new Scheduler.Synchronizer() { + public void beforeCompletion() { + + } + + public void afterCompletion(boolean success) { + // If the TX is rolled back, then we don't send the request. + if (!success) + return; + + // The invocation must happen in a separate thread, holding + // on the afterCompletion + // blocks other operations that could have been listed there + // as well. + _server.getExecutor().submit(new Callable() { + public Object call() throws Exception { + try { + // do execution + if(! (partnerRoleMessageExchange.getChannel() instanceof TuscanyPRC)) { + throw new IllegalArgumentException("Channel should be an instance of TuscanyPRC"); + } + + TuscanyPRC channel = (TuscanyPRC) partnerRoleMessageExchange.getChannel(); + RuntimeComponent tuscanyRuntimeComponent = _server.getTuscanyRuntimeComponent(channel.getProcessName()); + + RuntimeComponentReference runtimeComponentReference = + (RuntimeComponentReference)tuscanyRuntimeComponent.getReferences().get(0); + RuntimeWire runtimeWire = + runtimeComponentReference.getRuntimeWire(runtimeComponentReference.getBindings().get(0)); + + // convert operations + Operation operation = + findOperation(partnerRoleMessageExchange.getOperation().getName(), runtimeComponentReference); + + + /* + This is how a request looks like (payload is wrapped with extra info) + + + + + Luciano + + + + */ + Element msg = partnerRoleMessageExchange.getRequest().getMessage(); + if (msg != null) { + String xml = DOMUtils.domToString(msg); + + String payload = + DOMUtils.domToString(getPayload(partnerRoleMessageExchange.getRequest())); + + if(__log.isDebugEnabled()) { + __log.debug("Starting invocation of SCA Reference"); + __log.debug(">>> Original message: " + xml); + __log.debug(">>> Payload: " + payload); + } + + Object[] args = new Object[] {getPayload(partnerRoleMessageExchange.getRequest())}; + + Object result = null; + boolean success = false; + + try { + result = runtimeWire.invoke(operation, args); + success = true; + } catch (Exception e) { + partnerRoleMessageExchange.replyWithFailure(MessageExchange.FailureType.OTHER, + e.getMessage(), + null); + } + + + if(__log.isDebugEnabled()) { + __log.debug("SCA Reference invocation finished"); + __log.debug(">>> Result : " + DOMUtils.domToString((Element)result)); + } + + if (!success) { + return null; + } + + // two way invocation + // process results based on type of message + // invocation + + // Message response = + // createResponseMessage(partnerRoleMessageExchange, + // (Element) result); + // partnerRoleMessageExchange.reply(response); + replyTwoWayInvocation(partnerRoleMessageExchange.getMessageExchangeId(), + operation, + (Element)result); + } + + } catch (Throwable t) { + // some error + String errmsg = + "Error sending message (mex=" + partnerRoleMessageExchange + "): " + t.getMessage(); + __log.error(errmsg, t); + /*replyWithFailure(partnerRoleMessageExchange.getMessageExchangeId(), + MessageExchange.FailureType.COMMUNICATION_ERROR, + errmsg, + null);*/ + } + return null; + } + }); + + } + }); + partnerRoleMessageExchange.replyAsync(); + + } else { + /** one-way case * */ + _server.getExecutor().submit(new Callable() { + public Object call() throws Exception { + // do reply + // operationClient.execute(false); + return null; + } + }); + partnerRoleMessageExchange.replyOneWayOk(); + } + } + + + /** + * Find the SCA Reference operation + * + * @param operationName + * @param runtimeComponentReference + * @return + */ + private Operation findOperation(String operationName, RuntimeComponentReference runtimeComponentReference) { + Operation reseultOperation = null; + + for(Operation operation : runtimeComponentReference.getInterfaceContract().getInterface().getOperations()) { + if (operationName.equalsIgnoreCase(operation.getName())) { + reseultOperation = operation; + break; + } + } + return reseultOperation; + } + + /** + * Get paylod from a given ODEMessage + * @param odeMessage + * @return + */ + private Element getPayload(Message odeMessage) { + Element payload = null; + Element parameters = odeMessage.getPart("parameters"); + + if (parameters != null && parameters.hasChildNodes()) { + payload = (Element)parameters.getFirstChild(); + } + + return payload; + } + + + private void replyTwoWayInvocation(final String odeMexId, final Operation operation, final Element result) { + // ODE MEX needs to be invoked in a TX. + try { + _server.getScheduler().execIsolatedTransaction(new Callable() { + public Void call() throws Exception { + PartnerRoleMessageExchange odeMex = null; + try { + odeMex = (PartnerRoleMessageExchange)_server.getBpelServer().getEngine().getMessageExchange(odeMexId); + if (odeMex != null) { + Message response = createResponseMessage(odeMex, operation, (Element)result); + odeMex.reply(response); + } + } catch (Exception ex) { + String errmsg = "Unable to process response: " + ex.getMessage(); + if (odeMex != null) { + odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, null); + } + } + + return null; + } + }); + } catch (Exception ex) { + ex.printStackTrace(); + } + + } + + private Message createResponseMessage(PartnerRoleMessageExchange partnerRoleMessageExchange, + Operation operation, + Element invocationResult) { + Document dom = DOMUtils.newDocument(); + + String operationName = operation.getName(); + Part bpelOperationOutputPart = + (Part)((WSDLInterface)operation.getInterface()).getPortType().getOperation(operationName, null, null) + .getOutput().getMessage().getParts().values().iterator().next(); + + Element contentMessage = dom.createElement("message"); + Element contentPart = dom.createElement(bpelOperationOutputPart.getName()); + + contentPart.appendChild(dom.importNode(invocationResult, true)); + contentMessage.appendChild(contentPart); + dom.appendChild(contentMessage); + + if(__log.isDebugEnabled()) { + __log.debug("Creating result message:"); + __log.debug(">>>" + DOMUtils.domToString(dom.getDocumentElement())); + } + + QName id = partnerRoleMessageExchange.getOperation().getOutput().getMessage().getQName(); + Message response = partnerRoleMessageExchange.createMessage(id); + response.setMessage(dom.getDocumentElement()); + + return response; + } + +} diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java new file mode 100644 index 0000000000..2fa91e4e86 --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/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/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java new file mode 100644 index 0000000000..1ec82390cf --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java @@ -0,0 +1,57 @@ +/* + * 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 org.apache.ode.bpel.iapi.BpelEngineException; +import org.apache.ode.bpel.iapi.ContextException; +import org.apache.ode.bpel.iapi.MessageExchangeContext; +import org.apache.ode.bpel.iapi.MyRoleMessageExchange; +import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange; + +/** + * Message Exchange Context information + * + * @version $Rev$ $Date$ + */ +public class ODEMessageExchangeContext implements MessageExchangeContext { + private static final Log __log = LogFactory.getLog(ODEMessageExchangeContext.class); + + private EmbeddedODEServer _server; + + public ODEMessageExchangeContext(EmbeddedODEServer _server) { + this._server = _server; + } + + public void invokePartner(PartnerRoleMessageExchange partnerRoleMessageExchange) throws ContextException { + if (__log.isDebugEnabled()) { + __log.debug("Invoking a partner operation: " + partnerRoleMessageExchange.getOperationName()); + } + + ODEExternalService scaService = new ODEExternalService(_server); + scaService.invoke(partnerRoleMessageExchange); + } + + public void onAsyncReply(MyRoleMessageExchange myRoleMessageExchange) throws BpelEngineException { + if (__log.isDebugEnabled()) { + __log.debug("Processing an async reply from service " + myRoleMessageExchange.getServiceName()); + } + } + } diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java new file mode 100644 index 0000000000..a928379ba9 --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/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/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyEPR.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyEPR.java new file mode 100644 index 0000000000..deaeaec040 --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyEPR.java @@ -0,0 +1,49 @@ +/* + * 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 javax.xml.namespace.QName; + +import org.apache.ode.bpel.iapi.Endpoint; +import org.apache.ode.bpel.iapi.EndpointReference; +import org.apache.ode.utils.DOMUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * This should hold something that makes sense for Tuscany so that the + * process has an address that makes sense from the outside world perspective + * + * @version $Rev$ $Date$ + */ +public class TuscanyEPR implements EndpointReference { + private final Document doc = DOMUtils.newDocument(); + + public TuscanyEPR(QName processName, Endpoint endpoint) { + Element serviceref = doc.createElementNS(EndpointReference.SERVICE_REF_QNAME.getNamespaceURI(), + EndpointReference.SERVICE_REF_QNAME.getLocalPart()); + serviceref.setNodeValue(endpoint.serviceName + ":" + endpoint.portName); + doc.appendChild(serviceref); + } + + public Document toXML() { + return doc; + } +} diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyPRC.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyPRC.java new file mode 100644 index 0000000000..b0539970ec --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyPRC.java @@ -0,0 +1,65 @@ +/* + * 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 javax.wsdl.PortType; +import javax.xml.namespace.QName; + +import org.apache.ode.bpel.iapi.Endpoint; +import org.apache.ode.bpel.iapi.EndpointReference; +import org.apache.ode.bpel.iapi.PartnerRoleChannel; +import org.apache.ode.utils.DOMUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * Tuscany Partner Role Channel for ODE Integration + * + * @version $Rev$ $Date$ + */ +public class TuscanyPRC implements PartnerRoleChannel { + private final QName processName; + + public TuscanyPRC(QName processName, QName pid, PortType portType, Endpoint endpoint){ + this.processName = processName; + } + + public QName getProcessName() { + return this.processName; + } + + public void close() { + + } + + public EndpointReference getInitialEndpointReference() { + final Document doc = DOMUtils.newDocument(); + Element serviceref = doc.createElementNS(EndpointReference.SERVICE_REF_QNAME.getNamespaceURI(), + EndpointReference.SERVICE_REF_QNAME.getLocalPart()); + doc.appendChild(serviceref); + + return new EndpointReference() { + public Document toXML() { + return doc; + } + }; + } + +} diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java new file mode 100644 index 0000000000..5cc9a350ef --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java @@ -0,0 +1,437 @@ +/* + * 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.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.wsdl.Definition; +import javax.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.ode.bpel.compiler.BpelC; +import org.apache.ode.bpel.evt.BpelEvent.TYPE; +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.Reference; +import org.apache.tuscany.sca.assembly.Service; +import org.apache.tuscany.sca.implementation.bpel.BPELImplementation; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * A Tuscany implementation of the ODE Process Conf + * + * @version $Rev$ $Date$ + */ +public class TuscanyProcessConfImpl implements ProcessConf { + private final Log __log = LogFactory.getLog(getClass()); + + private BPELImplementation implementation; + private Map invokeEndpoints = null; + private Map provideEndpoints = null; + private Map properties = null; + private ProcessState processState; + private Date deployDate; + + private final String TUSCANY_NAMESPACE = "http://tuscany.apache.org"; + + /** + * Constructor for the ProcessConf implementation + * @param theImplementation the BPEL implementation for which this is the ProcessConf + */ + public TuscanyProcessConfImpl( BPELImplementation theImplementation ) { + //System.out.println("New TuscanyProcessConfImpl..."); + this.implementation = theImplementation; + + processState = ProcessState.ACTIVE; + deployDate = new Date(); + + // Compile the process + compile( getBPELFile() ); + } // end TuscanyProcessConfImpl constructor + + /** + * Returns the URI for the directory containing the BPEL process + */ + public URI getBaseURI() { + //System.out.println("getBaseURI called"); + File theDir = getDirectory(); + return theDir.toURI(); + } + + /** + * Returns a String containing the (local) name of the file containing the BPEL process + */ + public String getBpelDocument() { + //System.out.println("getBPELDocument called"); + try { + String location = this.implementation.getProcessDefinition().getLocation(); + URI locationURI = new URI(null, location, null); + File processFile = new File(locationURI); + return getRelativePath( getDirectory(), processFile); + } catch (Exception e) { + if(__log.isWarnEnabled()) { + __log.warn("Unable to resolve relative path of BPEL process" + implementation.getProcessDefinition().getLocation(), e ); + } + return null; + } // end try + } // end getBpelDocument + + /** + * Returns an InputStream containing the Compiled BPEL Process (CBP) + */ + public InputStream getCBPInputStream() { + //System.out.println("getCBPInputStream called"); + // Find the CBP file - it has the same name as the BPEL process and lives in the same + // directory as the process file + String cbpFileName = null; + try { + String fileName = getRelativePath( getDirectory(), getBPELFile() ); + cbpFileName = fileName.substring(0, fileName.lastIndexOf(".")) + ".cbp"; + } catch (Exception e ) { + // IOException trying to fetch the BPEL file name + if(__log.isDebugEnabled()) { + __log.debug("Unable to calculate the file name for BPEL process: " + + implementation.getProcessDefinition().getName(), e); + return null; + } // end if + } // end try + File cbpFile = new File( getDirectory(), cbpFileName ); + if( cbpFile.exists() ) { + // Create an InputStream from the cbp file... + try { + return new FileInputStream( cbpFile ); + } catch ( Exception e ) { + if(__log.isDebugEnabled()) { + __log.debug("Unable to open the cbp file for BPEL process: " + + implementation.getProcessDefinition().getName(), e); + } + } // end try + } else { + // Cannot find the cbp file + if(__log.isWarnEnabled()){ + __log.warn("Cannot find the cbp file for process: " + + implementation.getProcessDefinition().getName()); + } + } // end if + // TODO - need better exception handling if we can't open the cbp file for any reason + return null; + } // end getCBPInputStream + + /** + * Return the WSDL Definition for a given PortType + * @param portTypeName - the QName of the PortType + */ + public Definition getDefinitionForPortType( QName portTypeName ) { + //System.out.println("getDefinitionForPortType called for portType: " + portTypeName ); + // Find the named PortType in the list of WSDL interfaces associated with this BPEL Process + Collection theInterfaces = implementation.getProcessDefinition().getInterfaces(); + for( WSDLInterface wsdlInterface : theInterfaces ) { + if ( wsdlInterface.getPortType().getQName().equals( portTypeName ) ) { + // Extract and return the Definition associated with the WSDLDefinition... + return wsdlInterface.getWsdlDefinition().getDefinition(); + } // end if + } // end for + return null; + } // end getDefinitionforPortType + + /** + * Returns a WSDL Definition for a given Service QName + * + * 22/05/2008 - it is very unclear what this service QName is really meant to be. + * From the handling of the deploy.xml file by the current ODE code, it seems that the key link + * is from the Service QName to the PartnerLink name (done in the deploy.xml file). + * + * The curious part about this is that the QName for the service is ONLY defined in deploy.xml file + * and does not appear to relate to anything else, except for the QName of the PartnerLink + * + * The PartnerLink name is the same as the name of the SCA service (or reference) which in turn points + * at the PartnerLinkType which in turn points at an (WSDL) interface definition. + */ + public Definition getDefinitionForService(QName serviceQName ) { + //System.out.println("getDefinitionForService called for Service: " + serviceQName ); + if(__log.isDebugEnabled()){ + __log.debug("getDefinitionforService called for service: " + serviceQName ); + } + // TODO Auto-generated method stub + return null; + } + + /** + * Returns the date of deployment of the process + * - for SCA returns the date at which this object was created + */ + public Date getDeployDate() { + //System.out.println("getDeployDate called"); + return deployDate; + } + + /** + * Returns userid of deployer + * - always "SCA Tuscany" for Tuscany... + */ + public String getDeployer() { + //System.out.println("getDeployer called"); + return "SCA Tuscany"; + } // end getDeployer + + /** + * Returns a list of the files in the directory containing the BPEL Process + */ + public List getFiles() { + //System.out.println("getFiles called"); + File theDir = getDirectory(); + List theFiles = Arrays.asList( (File[]) theDir.listFiles() ); + // TODO recurse into subdirectories + return theFiles; + } // end getFiles + + /** + * Returns a Map containing all the "invoke endpoints" - for which read "SCA references" + * The map is keyed by partnerLink name and holds Endpoint objects + * + * TODO deal with service callbacks on bidirectional services + */ + public Map getInvokeEndpoints() { + //System.out.println("getInvokeEndpoints called"); + if( invokeEndpoints == null ) { + invokeEndpoints = new HashMap(); + // Get a collection of the references + List theReferences = implementation.getReferences(); + // Create an endpoint for each reference, using the reference name as the "service" + // name, combined with http://tuscany.apache.org to make a QName + for( Reference reference : theReferences ) { + invokeEndpoints.put( reference.getName(), + new Endpoint( new QName( TUSCANY_NAMESPACE, reference.getName() ), "ReferencePort")); + } // end for + } // end if + return invokeEndpoints; + } // end getInvokeEndpoints + + /** + * Returns the name of the directory containing the BPEL files + */ + public String getPackage() { + //System.out.println("getPackage called"); + File theDir = getDirectory(); + return theDir.getName(); + } // end getPackage + + /** + * Return the BPEL Process ID - which is the Process QName appended "-versionnumber" + */ + public QName getProcessId() { + //System.out.println("getProcessId called"); + QName processType = getType(); + QName processID = new QName( processType.getNamespaceURI(), + processType.getLocalPart() + "-" + getVersion() ); + return processID; + } // end getProcessID + + /** + * TODO - What are properties? + */ + public Map getProperties() { + //System.out.println("getProperties called"); + if ( properties == null ) { + properties = new HashMap(); + } // end if + return properties; + } // end getProperties + + /** + * Returns a Map containing all the "provide endpoints" - for which read "SCA services" + * The map is keyed by partnerLink name and holds Endpoint objects + * + * TODO deal with reference callbacks on bidirectional references + */ + public Map getProvideEndpoints() { + //System.out.println("getProvideEndpoints called"); + if( provideEndpoints == null ) { + provideEndpoints = new HashMap(); + // Get a collection of the references + List theServices = implementation.getServices(); + // Create an endpoint for each reference, using the reference name as the "service" + // name, combined with http://tuscany.apache.org to make a QName + for( Service service : theServices ) { + provideEndpoints.put( service.getName(), + new Endpoint( new QName( TUSCANY_NAMESPACE, service.getName() ), "ServicePort")); + } // end for + } // end if + return provideEndpoints; + } // end getProvideEndpoints + + /** + * Return the process state + */ + public ProcessState getState() { + //System.out.println("getState called"); + return processState; + } + + /** + * Returns the QName of the BPEL process + */ + public QName getType() { + //System.out.println("getType called"); + return implementation.getProcess(); + } + + /** + * Gets the process Version number + * - current code does not have versions for BPEL processes and always returns "1" + */ + public long getVersion() { + //System.out.println("getVersion called"); + return 1; + } + + /** + * Returns true if the supplied event type is enabled for any of the scopes in the provided + * List. These events are "ODE Execution Events" and there is a definition of them on this + * page: http://ode.apache.org/user-guide.html#UserGuide-ProcessDeployment + * + * For the present Tuscany does not support manipulating the event enablement and always + * returns that the event is not enabled + * @param scopeNames - list of BPEL process Scope names + * @param type - the event type + */ + public boolean isEventEnabled(List scopeNames, TYPE type) { + //System.out.println("isEventEnabled called with scopeNames: " + + // scopeNames + " and type: " + type ); + return false; + } // end isEventEnabled + + /** + * Returns whether the process is persisted in the store + * + * Returns false for SCA configuration + * - returning true causes problems in communicating with the BPEL process + */ + public boolean isTransient() { + //System.out.println("isTransient called"); + return false; + } // end isTransient + + /** + * Compiles a BPEL process file into a compiled form CBP file in the main directory + * (ie same directory as the BPEL process file) + * @param bpelFile - the BPEL process file + */ + private void compile( File bpelFile ) { + // Set up the compiler + BpelC compiler = BpelC.newBpelCompiler(); + // Provide a null set of initial properties for now + Map processProps = new HashMap(); + Map compileProps = new HashMap(); + compileProps.put( BpelC.PROCESS_CUSTOM_PROPERTIES, processProps ); + compiler.setCompileProperties( compileProps ); + compiler.setBaseDirectory( getDirectory() ); + + // Run the compiler and generate the CBP file into the given directory + try { + compiler.compile( bpelFile ); + } catch (IOException e) { + if(__log.isDebugEnabled()) { + __log.debug("Compile error in " + bpelFile, e); + } + // TODO - need better exception handling here + } // end try + } // end compile + + /** + * Gets the directory containing the BPEL process + * @return + */ + private File getDirectory() { + File theDir = getBPELFile().getParentFile(); + return theDir; + } // end getDirectory + + /** + * Gets the File containing the BPEL process definition + * @return - the File object containing the BPEL process + */ + private File getBPELFile() { + try { + String location = this.implementation.getProcessDefinition().getLocation(); + URI locationURI = new URI(null, location, null); + File theProcess = new File(locationURI); + return theProcess; + } catch( Exception e ) { + if(__log.isDebugEnabled()) { + __log.debug("Exception converting BPEL file URL to an URI: " + e ); + } + } // end try + return null; + } // end getBPELFile + + /** + * Gets the relative path of a file against a directory in its hierarchy + * @param base - the base directory + * @param path - the file + * @return + * @throws IOException + */ + private String getRelativePath(File base, File path) throws IOException { + String basePath = base.getCanonicalPath(); + String filePath = path.getCanonicalPath(); + if (!filePath.startsWith(basePath)) { + throw new IOException("Invalid relative path: base=" + base + " path=" + path); + } + String relative = filePath.substring(basePath.length()); + if (relative.startsWith(File.separator)) { + relative = relative.substring(1); + } + return relative; + } // end getRelativePath + + //----------------------------------------------------------------------------- + // other public APIs which ProcessConfImpl displays which are not in ProcessConf interface + + public List getMexInterceptors(QName processId) { +// System.out.println("getMexInterceptors for processID: " + processId ); + return null; + } + + public void setTransient(boolean t) { +// System.out.println("setTransient called with boolean: " + t ); + } + + public List getExtensionElement(QName arg0) { + return Collections.emptyList(); + } + // end of other public APIs + //----------------------------------------------------------------------------- + +} // end class TuscanyProcessConfImpl diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java new file mode 100644 index 0000000000..c500f001dc --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java @@ -0,0 +1,146 @@ +/* + * 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.provider; + +import java.io.File; +import java.net.URI; + +import javax.transaction.TransactionManager; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.tuscany.sca.assembly.Reference; +import org.apache.tuscany.sca.assembly.Service; +import org.apache.tuscany.sca.databinding.xml.DOMDataBinding; +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; + +/** + * BPEL Implementation provider + * + * @version $Rev$ $Date$ + */ +public class BPELImplementationProvider implements ImplementationProvider { + private final Log __log = LogFactory.getLog(getClass()); + + private RuntimeComponent component; + private BPELImplementation implementation; + + private EmbeddedODEServer odeServer; + private TransactionManager txMgr; + + /** + * 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; + + // Configure the service and reference interfaces to use a DOM databinding + // as it's what ODE expects + for (Service service: implementation.getServices()) { + service.getInterfaceContract().getInterface().resetDataBinding(DOMDataBinding.NAME); + } + for (Reference reference: implementation.getReferences()) { + reference.getInterfaceContract().getInterface().resetDataBinding(DOMDataBinding.NAME); + } + + } + + public Invoker createInvoker(RuntimeComponentService service, Operation operation) { + BPELInvoker invoker = new BPELInvoker(component, service, operation, odeServer, txMgr); + return invoker; + } + + public boolean supportsOneWayInvocation() { + return false; + } + + public void start() { + if(__log.isInfoEnabled()) { + __log.info("Starting " + component.getName()); + } + + try { + if (!odeServer.isInitialized()) { + // start ode server + odeServer.init(); + } + + String location = this.implementation.getProcessDefinition().getLocation(); + URI deployURI = new URI(null, location, null); + + File deploymentDir = new File(deployURI).getParentFile(); + + if(__log.isInfoEnabled()) { + __log.info(">>> Deploying : " + deploymentDir.toString()); + } + + // deploy the process + if (odeServer.isInitialized()) { + try { + //txMgr.begin(); + odeServer.registerTuscanyRuntimeComponent(implementation.getProcess(), component); + // Replaced by Mike Edwards 23/05/2008 + //odeServer.deploy(new ODEDeployment(deploymentDir)); + odeServer.deploy(new ODEDeployment(deploymentDir), implementation ); + //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); + } + } + + public void stop() { + if(__log.isInfoEnabled()) { + __log.info("Stopping " + component.getName()); + } + + if (odeServer.isInitialized()) { + // start ode server + odeServer.stop(); + } + + txMgr = null; + + if(__log.isInfoEnabled()) { + __log.info("Stopped !!!"); + } + } + +} diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProviderFactory.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProviderFactory.java new file mode 100644 index 0000000000..ed327e237b --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProviderFactory.java @@ -0,0 +1,69 @@ +/* + * 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.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; +import org.oasisopen.sca.annotation.Destroy; + +/** + * BPEL Implementation provider factory + * + * We use the provider factory to instantiate a ODE server that is going to be injected in all BPEL components + * + * @version $Rev$ $Date$ + */ +public class BPELImplementationProviderFactory implements ImplementationProviderFactory { + + 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 getModelType() { + return BPELImplementation.class; + } + + @Destroy + public void destroy() { + txMgr = null; + } +} diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java new file mode 100644 index 0000000000..e07fdbc302 --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java @@ -0,0 +1,242 @@ +/* + * 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.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.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +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.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; +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. + * + * @version $Rev$ $Date$ + */ +public class BPELInvoker implements Invoker { + protected final Log __log = LogFactory.getLog(getClass()); + + private EmbeddedODEServer odeServer; + private TransactionManager txMgr; + + private RuntimeComponentService service; + private Operation operation; + private QName bpelServiceName; + private String bpelOperationName; + private Part bpelOperationInputPart; + private Part bpelOperationOutputPart; + + public BPELInvoker(RuntimeComponent component, RuntimeComponentService service, Operation operation, EmbeddedODEServer odeServer, TransactionManager txMgr) { + this.service = service; + this.operation = operation; + this.bpelOperationName = operation.getName(); + this.odeServer = odeServer; + this.txMgr = txMgr; + + initializeInvocation(); + } + + + private void initializeInvocation() { + + __log.debug("Initializing BPELInvoker"); + + Interface interfaze = operation.getInterface(); + if(interfaze instanceof WSDLInterface){ + WSDLInterface wsdlInterface = null; + wsdlInterface = (WSDLInterface) interfaze; + + // The following commented out code is bogus and is replaced by what follows - Mike Edwards + // Service serviceDefinition = (Service) wsdlInterface.getWsdlDefinition().getDefinition().getAllServices().values().iterator().next(); + // bpelServiceName = serviceDefinition.getQName(); + // + // Fetch the service name from the service object + bpelServiceName = new QName( "http://tuscany.apache.org", service.getName() ); + + 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()); + + if (__log.isDebugEnabled()) { + Status status = mex.getStatus(); + Element invocationResponse = mex.getResponse().getMessage(); + __log.debug(">>>Invocation status:" + status.name()); + __log.debug(">>>Response:\n" + DOMUtils.domToString(invocationResponse)); + __log.debug(">>>Response:\n" + DOMUtils.domToString(invocationResponse)); + } + + //process the method invocation result + response = processResponse(mex.getResponse().getMessage()); + + 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 : + * + * + * Hello + * + * + * @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 payload = null; + + //TUSCANY-2321 - Properly handling Document or Element types + if(args[0] instanceof Document) { + payload = (Element) ((Document) args[0]).getFirstChild(); + } else { + payload = (Element) args[0]; + } + + contentPart.appendChild(dom.importNode(payload, true)); + contentMessage.appendChild(contentPart); + dom.appendChild(contentMessage); + + if (__log.isDebugEnabled()) { + __log.debug("Creating invocation message:"); + __log.debug(">> args.....: " + DOMUtils.domToString(payload)); + __log.debug(">> 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 + * + * + * + * World + * + * + * + * @param response + * @return + */ + private Element processResponse(Element response) { + return (Element) DOMUtils.findChildByName(response, new QName("",bpelOperationOutputPart.getName())); + } +} diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/java/sca/modules/implementation-bpel-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory new file mode 100644 index 0000000000..3bce8aa9ab --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/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.ode.provider.BPELImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.bpel.BPELImplementation diff --git a/java/sca/modules/implementation-bpel-runtime/src/test/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServerTestCase.java b/java/sca/modules/implementation-bpel-runtime/src/test/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServerTestCase.java new file mode 100644 index 0000000000..0f59990377 --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/test/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServerTestCase.java @@ -0,0 +1,124 @@ +/* + * 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 javax.transaction.TransactionManager; + +import junit.framework.TestCase; + +/** + * Test to Deploy and Invoke a HelloWorld BPEL process using EmbeddedODEServer + * + * Major changes introduced to this testcase on 27/05/2008 associated with changes in the + * implementation of EmbeddedODEServer which remove the need for the ODE deploy.xml file - + * instead a Tuscany BPELImplementation object is passed to the EmbeddedODEServer and this is + * introspected to get all the necessary information about the BPEL process + * + * @version $Rev$ $Date$ + */ +public class EmbeddedODEServerTestCase extends TestCase { + + private EmbeddedODEServer odeServer; + + private TransactionManager txMgr; + + @Override + protected void setUp() throws Exception { + // Set up the ODE BPEL server... + GeronimoTxFactory txFactory = new GeronimoTxFactory(); + txMgr = txFactory.getTransactionManager(); + + this.odeServer = new EmbeddedODEServer(txMgr); + odeServer.init(); + + } // end setUp + + @Override + protected void tearDown() throws Exception { + odeServer.stop(); + } + + public void testProcessInvocation() throws Exception { + if (!odeServer.isInitialized()) { + fail("Server did not start !"); + } +// TODO - write effective testcase - made problematic by the need to supply a resolved +// BPELImplementation +/* + URL deployURL = getClass().getClassLoader().getResource("helloworld/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), implementation); + 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("Hello")); + 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(); + } // end try + } // end if +*/ + } // end testProcessInvocation + +} diff --git a/java/sca/modules/implementation-bpel-runtime/src/test/resources/helloworld/deploy.xml b/java/sca/modules/implementation-bpel-runtime/src/test/resources/helloworld/deploy.xml new file mode 100644 index 0000000000..571aa37d58 --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/test/resources/helloworld/deploy.xml @@ -0,0 +1,30 @@ + + + + + + true + + + + + diff --git a/java/sca/modules/implementation-bpel-runtime/src/test/resources/helloworld/greetings.wsdl b/java/sca/modules/implementation-bpel-runtime/src/test/resources/helloworld/greetings.wsdl new file mode 100644 index 0000000000..bcd3ea6afa --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/test/resources/helloworld/greetings.wsdl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/modules/implementation-bpel-runtime/src/test/resources/helloworld/helloworld.bpel b/java/sca/modules/implementation-bpel-runtime/src/test/resources/helloworld/helloworld.bpel new file mode 100644 index 0000000000..8cf91adc2c --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/test/resources/helloworld/helloworld.bpel @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + concat($tmpVar,' World') + + + + + + diff --git a/java/sca/modules/implementation-bpel-runtime/src/test/resources/helloworld/helloworld.wsdl b/java/sca/modules/implementation-bpel-runtime/src/test/resources/helloworld/helloworld.wsdl new file mode 100644 index 0000000000..1d71727b2d --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/test/resources/helloworld/helloworld.wsdl @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/modules/implementation-bpel-runtime/src/test/resources/log4j.properties b/java/sca/modules/implementation-bpel-runtime/src/test/resources/log4j.properties new file mode 100644 index 0000000000..82b3c09723 --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/test/resources/log4j.properties @@ -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. +# + +# Set root logger level to WARN and its only appender to CONSOLE +log4j.rootLogger=OFF, CONSOLE + +# log4j properties to work with commandline tools. +log4j.category.org.mortbay=OFF +log4j.category.org.hibernate.type=OFF +log4j.category.org.objectweb=OFF +log4j.category.org.apache.ode.axis2=OFF +log4j.category.org.apache.ode.bpel.engine=OFF +log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF +log4j.category.org.apache.ode.bpel.epr=OFF +log4j.category.org.apache.tuscany.sca.implementation.bpel=OFF +log4j.category.org.apache.tuscany.sca.implementation.bpel.ode=OFF +log4j.category.org.apache.tuscany.sca.implementation.bpel.ode.provider=OFF + +# 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 diff --git a/java/sca/modules/pom.xml b/java/sca/modules/pom.xml index 6438c9db4d..45c8782a67 100644 --- a/java/sca/modules/pom.xml +++ b/java/sca/modules/pom.xml @@ -64,7 +64,7 @@ host-rmi host-webapp implementation-bpel - implementation-bpel-ode + implementation-bpel-runtime implementation-java implementation-java-runtime implementation-node diff --git a/java/sca/samples/helloworld-bpel/pom.xml b/java/sca/samples/helloworld-bpel/pom.xml index 6a1eee7936..a088095712 100644 --- a/java/sca/samples/helloworld-bpel/pom.xml +++ b/java/sca/samples/helloworld-bpel/pom.xml @@ -44,7 +44,7 @@ org.apache.tuscany.sca - tuscany-implementation-bpel-ode + tuscany-implementation-bpel-runtime 2.0-SNAPSHOT runtime -- cgit v1.2.3