From bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a Mon Sep 17 00:00:00 2001 From: dims Date: Tue, 17 Jun 2008 00:23:01 +0000 Subject: Move Tuscany from Incubator to top level. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca-node/modules/binding-sca-axis2/DISCLAIMER | 8 + .../sca-node/modules/binding-sca-axis2/LICENSE | 205 ++++++++++++++++++ .../java/sca-node/modules/binding-sca-axis2/NOTICE | 6 + .../sca-node/modules/binding-sca-axis2/pom.xml | 116 +++++++++++ .../sca/axis2/impl/Axis2SCABindingInvoker.java | 100 +++++++++ .../axis2/impl/Axis2SCABindingProviderFactory.java | 80 +++++++ .../impl/Axis2SCAReferenceBindingProvider.java | 197 +++++++++++++++++ .../axis2/impl/Axis2SCAServiceBindingProvider.java | 136 ++++++++++++ .../sca/axis2/impl/Axis2SCAServiceProvider.java | 85 ++++++++ ...che.tuscany.sca.provider.BindingProviderFactory | 19 ++ .../sca/binding/sca/axis2/AsynchTestCase.java | 73 +++++++ .../BindingScaEndpointResolverFactoryImpl.java | 50 +++++ .../sca/axis2/BindingScaEndpointResolverImpl.java | 69 ++++++ .../sca/binding/sca/axis2/CallbackTestCase.java | 77 +++++++ .../sca/binding/sca/axis2/PromotionTestCase.java | 66 ++++++ .../sca/binding/sca/axis2/SimpleTestCase.java | 105 ++++++++++ .../tuscany/sca/binding/sca/axis2/TestNode.java | 232 +++++++++++++++++++++ .../axis2/helloworld/HelloWorldCallbackRemote.java | 29 +++ .../sca/axis2/helloworld/HelloWorldClient.java | 27 +++ .../HelloWorldServiceCallbackOnewayRemote.java | 33 +++ .../HelloWorldServiceCallbackRemote.java | 31 +++ .../axis2/helloworld/HelloWorldServiceLocal.java | 27 +++ .../axis2/helloworld/HelloWorldServiceRemote.java | 29 +++ .../axis2/helloworld/HelloWorldServiceRemote2.java | 29 +++ .../HelloWorldClientCallbackOnewayRemoteImpl.java | 43 ++++ .../impl/HelloWorldClientCallbackRemoteImpl.java | 42 ++++ .../helloworld/impl/HelloWorldClientLocalImpl.java | 35 ++++ .../impl/HelloWorldClientRemote2Impl.java | 35 ++++ .../impl/HelloWorldClientRemoteImpl.java | 35 ++++ .../HelloWorldServiceCallbackOnewayRemoteImpl.java | 36 ++++ .../impl/HelloWorldServiceCallbackRemoteImpl.java | 35 ++++ .../impl/HelloWorldServiceLocalImpl.java | 30 +++ .../HelloWorldServiceMultipleServicesImpl.java | 41 ++++ .../impl/HelloWorldServiceRemoteImpl.java | 30 +++ ...ny.sca.endpointresolver.EndpointResolverFactory | 19 ++ .../src/test/resources/nodeA/HelloWorld.composite | 75 +++++++ .../resources/nodeA/META-INF/sca-contribution.xml | 24 +++ .../src/test/resources/nodeB/HelloWorld.composite | 84 ++++++++ .../resources/nodeB/META-INF/sca-contribution.xml | 24 +++ .../src/test/resources/nodeC/HelloWorld.composite | 35 ++++ .../resources/nodeC/HelloWorldComponent.composite | 37 ++++ .../resources/nodeC/META-INF/sca-contribution.xml | 24 +++ .../src/test/resources/nodeD/HelloWorld.composite | 35 ++++ .../resources/nodeD/HelloWorldComponent.composite | 37 ++++ .../resources/nodeD/META-INF/sca-contribution.xml | 24 +++ .../src/test/resources/nodeE/HelloWorld.composite | 36 ++++ .../resources/nodeE/META-INF/sca-contribution.xml | 24 +++ .../src/test/resources/nodeF/HelloWorld.composite | 43 ++++ .../resources/nodeF/META-INF/sca-contribution.xml | 24 +++ .../src/test/resources/nodeG/HelloWorld.composite | 36 ++++ .../resources/nodeG/META-INF/sca-contribution.xml | 24 +++ .../src/test/resources/nodeH/HelloWorld.composite | 38 ++++ .../resources/nodeH/META-INF/sca-contribution.xml | 24 +++ 53 files changed, 2858 insertions(+) create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/DISCLAIMER create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/LICENSE create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/NOTICE create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/pom.xml create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceProvider.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BindingScaEndpointResolverFactoryImpl.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BindingScaEndpointResolverImpl.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.java create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeA/HelloWorld.composite create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeA/META-INF/sca-contribution.xml create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeB/HelloWorld.composite create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeB/META-INF/sca-contribution.xml create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorld.composite create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorldComponent.composite create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeC/META-INF/sca-contribution.xml create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorld.composite create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorldComponent.composite create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeD/META-INF/sca-contribution.xml create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeE/HelloWorld.composite create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeE/META-INF/sca-contribution.xml create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeF/HelloWorld.composite create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeF/META-INF/sca-contribution.xml create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeG/HelloWorld.composite create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeG/META-INF/sca-contribution.xml create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeH/HelloWorld.composite create mode 100644 sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeH/META-INF/sca-contribution.xml (limited to 'sandbox/sebastien/java/sca-node/modules/binding-sca-axis2') diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/DISCLAIMER b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/DISCLAIMER new file mode 100644 index 0000000000..d68a410903 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/DISCLAIMER @@ -0,0 +1,8 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/LICENSE b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/LICENSE new file mode 100644 index 0000000000..6e529a25c4 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/LICENSE @@ -0,0 +1,205 @@ + + 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. + + + diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/NOTICE b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/NOTICE new file mode 100644 index 0000000000..1325efd8bf --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/NOTICE @@ -0,0 +1,6 @@ +${pom.name} +Copyright (c) 2005 - 2008 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/pom.xml b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/pom.xml new file mode 100644 index 0000000000..95471b05ba --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/pom.xml @@ -0,0 +1,116 @@ + + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-modules + 2.0-incubating-SNAPSHOT + ../pom.xml + + + tuscany-binding-sca-axis2 + Apache Tuscany SCA Axis2-based Default Binding Extension + + + + + org.apache.tuscany.sca + tuscany-binding-sca + 2.0-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-incubating-SNAPSHOT + + + + javax.servlet + servlet-api + 2.4 + provided + + + + org.easymock + easymock + 2.2 + test + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-incubating-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-incubating-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-incubating-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-interface-wsdl-java2wsdl + 2.0-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-endpoint + 2.0-incubating-SNAPSHOT + test + + + + + + + + + org.apache.felix + maven-bundle-plugin + + + + ${tuscany.version} + org.apache.tuscany.sca.binding.sca.axis2 + ${pom.name} + org.apache.tuscany.sca.binding.sca.axis2* + + + + + + + diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java new file mode 100644 index 0000000000..e4bb708a01 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java @@ -0,0 +1,100 @@ +/* + * 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.binding.sca.axis2.impl; + +import java.util.logging.Logger; + +import org.apache.tuscany.sca.invocation.Interceptor; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.runtime.EndpointReference; +import org.osoa.sca.ServiceUnavailableException; + + +/** + * A wrapper for the Axis2BindingInvoker that ensures that the URL of the target + * service is correct by looking it up in the service registry if it is not provided + * + * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $ + */ +public class Axis2SCABindingInvoker implements Interceptor { + + private static final Logger logger = Logger.getLogger(Axis2SCABindingInvoker.class.getName()); + + private Invoker axis2Invoker; + private Axis2SCAReferenceBindingProvider provider; + + public Axis2SCABindingInvoker(Axis2SCAReferenceBindingProvider provider, Invoker axis2Invoker) { + this.axis2Invoker = axis2Invoker; + this.provider = provider; + } + + public void setNext(Invoker next) { + } + + public Invoker getNext() { + return null; + } + + /** + * Fix up the URL for the message. The "to" EndPoint comes from the wire + * target and needs to be replaced with the endpoint from the registry. + * The default URL for an Endpoint URI where there is no + * target component or service information, as in the case of a + * wire crossing a node boundary, is "/" + */ + public Message invoke(Message msg) { + + // make sure that the epr of the target service is set in the TO + // field of the message + EndpointReference to = msg.getTo(); + + // check to see if we either don't have an endpoint set or if the URI + // is dynamic or the target service is marked as unresolved + if ((to == null) || (to.getURI().equals("/") || (to.getContract() == null) || (to.getContract().isUnresolved()))) { + + EndpointReference eprTo = provider.getServiceEndpoint(); + + if ( (eprTo == null) || (eprTo.getURI() == null)) { + throw new ServiceUnavailableException("Endpoint for service: " + provider.getSCABinding().getURI() + + " can't be found for component: " + + provider.getComponent().getName() + + " reference: " + + provider.getComponentReference().getName()); + } + msg.setTo(eprTo); + } + + // make sure that the epr of the callback service (if there is one) is set + // in the callbackReference field of the message. + EndpointReference callbackEPR = msg.getFrom().getReferenceParameters().getCallbackReference(); + + if ((callbackEPR == null) || (callbackEPR.getURI().equals("/"))) { + + callbackEPR = provider.getCallbackEndpoint(); + + if (callbackEPR != null) { + msg.getFrom().getReferenceParameters().setCallbackReference(callbackEPR); + } + } + + // do the axis2 stuff + return axis2Invoker.invoke(msg); + } +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java new file mode 100644 index 0000000000..024009095e --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java @@ -0,0 +1,80 @@ +/* + * 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.binding.sca.axis2.impl; + +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.sca.binding.sca.DistributedSCABinding; +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; +import org.apache.tuscany.sca.host.http.ServletHost; +import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint; +import org.apache.tuscany.sca.invocation.MessageFactory; +import org.apache.tuscany.sca.policy.util.PolicyHandlerDefinitionsLoader; +import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple; +import org.apache.tuscany.sca.provider.BindingProviderFactory; +import org.apache.tuscany.sca.provider.ReferenceBindingProvider; +import org.apache.tuscany.sca.provider.ServiceBindingProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentReference; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; + +/** + * The factory for the Axis2 based implementation of the distributed sca binding + * + * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $ + */ +public class Axis2SCABindingProviderFactory implements BindingProviderFactory { + + private ModelFactoryExtensionPoint modelFactories; + private ServletHost servletHost; + private Map> policyHandlerClassnames = null; + private DataBindingExtensionPoint dataBindings; + + public Axis2SCABindingProviderFactory(ExtensionPointRegistry extensionPoints) { + ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class); + servletHost = servletHosts.getServletHosts().get(0); + modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + policyHandlerClassnames = PolicyHandlerDefinitionsLoader.loadPolicyHandlerClassnames(); + dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class); + } + + public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, + RuntimeComponentReference reference, + DistributedSCABinding binding) { + return new Axis2SCAReferenceBindingProvider(component, reference, binding, + servletHost, modelFactories, + policyHandlerClassnames, dataBindings); + } + + public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, + RuntimeComponentService service, + DistributedSCABinding binding) { + return new Axis2SCAServiceBindingProvider(component, service, binding, + servletHost, modelFactories, + policyHandlerClassnames, dataBindings); + } + + public Class getModelType() { + return DistributedSCABinding.class; + } +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java new file mode 100644 index 0000000000..ce8e19e618 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java @@ -0,0 +1,197 @@ +/* + * 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.binding.sca.axis2.impl; + +import java.net.URI; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.SCABinding; +import org.apache.tuscany.sca.binding.sca.DistributedSCABinding; +import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory; +import org.apache.tuscany.sca.binding.ws.WebServiceBinding; +import org.apache.tuscany.sca.binding.ws.axis2.Axis2ReferenceBindingProvider; +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.contribution.resolver.ModelResolver; +import org.apache.tuscany.sca.contribution.resolver.ResolverExtension; +import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl; +import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; +import org.apache.tuscany.sca.host.http.ServletHost; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory; +import org.apache.tuscany.sca.interfacedef.wsdl.java2wsdl.Java2WSDLHelper; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.MessageFactory; +import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple; +import org.apache.tuscany.sca.provider.ReferenceBindingProvider; +import org.apache.tuscany.sca.runtime.EndpointReference; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentReference; +import org.apache.tuscany.sca.xsd.XSDFactory; + +/** + * The reference binding provider for the remote sca binding implementation. Relies on the + * binding-ws-axis implementation for sending messages to remote services to this provider + * just uses the ws-axis provider. + * + * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $ + */ +public class Axis2SCAReferenceBindingProvider implements ReferenceBindingProvider { + + private static final Logger logger = Logger.getLogger(Axis2SCAReferenceBindingProvider.class.getName()); + + private RuntimeComponent component; + private RuntimeComponentReference reference; + private SCABinding binding; + private Axis2ReferenceBindingProvider axisReferenceBindingProvider; + private WebServiceBinding wsBinding; + + private EndpointReference serviceEPR = null; + private EndpointReference callbackEPR = null; + + public Axis2SCAReferenceBindingProvider(RuntimeComponent component, + RuntimeComponentReference reference, + DistributedSCABinding binding, + ServletHost servletHost, + ModelFactoryExtensionPoint modelFactories, + Map> policyHandlerClassnames, + DataBindingExtensionPoint dataBindings) { + + WSDLFactory wsdlFactory = modelFactories.getFactory(WSDLFactory.class); + XSDFactory xsdFactory = modelFactories.getFactory(XSDFactory.class); + + this.component = component; + this.reference = reference; + this.binding = binding.getSCABinding(); + wsBinding = modelFactories.getFactory(WebServiceBindingFactory.class).createWebServiceBinding(); + + // Turn the java interface contract into a WSDL interface contract + InterfaceContract contract = reference.getInterfaceContract(); + if ((contract instanceof JavaInterfaceContract)) { + ModelResolver resolver = component instanceof ResolverExtension ? + ((ResolverExtension)component).getModelResolver() : null; + contract = Java2WSDLHelper.createWSDLInterfaceContract( + (JavaInterfaceContract)contract, resolver, dataBindings, wsdlFactory, xsdFactory); + } + + // Set to use the Axiom data binding + contract.getInterface().resetDataBinding(OMElement.class.getName()); + + wsBinding.setBindingInterfaceContract(contract); + wsBinding.setName(this.binding.getName()); + + axisReferenceBindingProvider = new Axis2ReferenceBindingProvider(component, + reference, + wsBinding, + servletHost, + modelFactories, + policyHandlerClassnames, + dataBindings); + } + + public InterfaceContract getBindingInterfaceContract() { + return wsBinding.getBindingInterfaceContract(); + } + + public boolean supportsOneWayInvocation() { + return false; + } + + public Invoker createInvoker(Operation operation) { + return new Axis2SCABindingInvoker(this, axisReferenceBindingProvider.createInvoker(operation)); + } + + /** + * Uses the distributed domain service discovery feature to locate remote + * service endpoints + * + * @return An EPR for the target service that this reference refers to + */ + public EndpointReference getServiceEndpoint(){ + + if (serviceEPR == null){ + String endpointURL = null; + + if (binding.getURI() != null) { + // check if the binding URI is already resolved if it is use is if not + try { + URI uri = new URI(binding.getURI()); + if (uri.isAbsolute()) { + endpointURL = binding.getURI(); + } + } catch(Exception ex) { + // do nothing + } + } + + serviceEPR = new EndpointReferenceImpl(endpointURL); + } + + return serviceEPR; + } + + + /** + * Retrieves the URI of the callback service (that this reference has created) + * returns null if there is no callback service for the sca binding + * + * @return the callback endpoint + */ + public EndpointReference getCallbackEndpoint(){ + if (callbackEPR == null) { + if (reference.getCallbackService() != null) { + for (Binding callbackBinding : reference.getCallbackService().getBindings()) { + if (callbackBinding instanceof SCABinding) { + callbackEPR = new EndpointReferenceImpl(reference.getName() + "/" + callbackBinding.getName()); + continue; + } + } + } + } + return callbackEPR; + } + + + public SCABinding getSCABinding () { + return binding; + } + + public RuntimeComponent getComponent () { + return component; + } + + public RuntimeComponentReference getComponentReference () { + return reference; + } + + public void start() { + axisReferenceBindingProvider.start(); + } + + public void stop() { + axisReferenceBindingProvider.stop(); + } + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java new file mode 100644 index 0000000000..14f209d245 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java @@ -0,0 +1,136 @@ +/* + * 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.binding.sca.axis2.impl; + +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.sca.assembly.SCABinding; +import org.apache.tuscany.sca.binding.sca.DistributedSCABinding; +import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory; +import org.apache.tuscany.sca.binding.ws.WebServiceBinding; +import org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvider; +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.contribution.resolver.ModelResolver; +import org.apache.tuscany.sca.contribution.resolver.ResolverExtension; +import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; +import org.apache.tuscany.sca.host.http.ServletHost; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory; +import org.apache.tuscany.sca.interfacedef.wsdl.java2wsdl.Java2WSDLHelper; +import org.apache.tuscany.sca.invocation.MessageFactory; +import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple; +import org.apache.tuscany.sca.provider.ServiceBindingProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; +import org.apache.tuscany.sca.xsd.XSDFactory; + +/** + * The service binding provider for the remote sca binding implementation. Relies on the + * binding-ws-axis implementation for providing a remote message endpoint for this service + * + * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $ + */ +public class Axis2SCAServiceBindingProvider implements ServiceBindingProvider { + + private static final Logger logger = Logger.getLogger(Axis2SCAServiceBindingProvider.class.getName()); + + private SCABinding binding; + private Axis2ServiceProvider axisProvider; + private WebServiceBinding wsBinding; + + private boolean started = false; + + + public Axis2SCAServiceBindingProvider(RuntimeComponent component, + RuntimeComponentService service, + DistributedSCABinding binding, + ServletHost servletHost, + ModelFactoryExtensionPoint modelFactories, + Map> policyHandlerClassnames, + DataBindingExtensionPoint dataBindings) { + + MessageFactory messageFactory = modelFactories.getFactory(MessageFactory.class); + WSDLFactory wsdlFactory = modelFactories.getFactory(WSDLFactory.class); + XSDFactory xsdFactory = modelFactories.getFactory(XSDFactory.class); + + this.binding = binding.getSCABinding(); + wsBinding = modelFactories.getFactory(WebServiceBindingFactory.class).createWebServiceBinding(); + + // Turn the java interface contract into a WSDL interface contract + InterfaceContract contract = service.getInterfaceContract(); + if ((contract instanceof JavaInterfaceContract)) { + ModelResolver resolver = component instanceof ResolverExtension ? + ((ResolverExtension)component).getModelResolver() : null; + contract = Java2WSDLHelper.createWSDLInterfaceContract( + (JavaInterfaceContract)contract, resolver, dataBindings, wsdlFactory, xsdFactory); + } + + // Set to use the Axiom data binding + contract.getInterface().resetDataBinding(OMElement.class.getName()); + + wsBinding.setBindingInterfaceContract(contract); + wsBinding.setName(this.binding.getName()); + wsBinding.setURI(this.binding.getURI()); + + axisProvider = new Axis2SCAServiceProvider(component, + service, + this.binding, + wsBinding, + servletHost, + messageFactory, + policyHandlerClassnames); + + this.binding.setURI(wsBinding.getURI()); + + } + + public InterfaceContract getBindingInterfaceContract() { + return wsBinding.getBindingInterfaceContract(); + } + + public boolean supportsOneWayInvocation() { + return false; + } + + public void start() { + if (started) { + return; + } else { + started = true; + } + + axisProvider.start(); + } + + public void stop() { + if (!started) { + return; + } else { + started = false; + } + + axisProvider.stop(); + } + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceProvider.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceProvider.java new file mode 100644 index 0000000000..42f7676ecb --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceProvider.java @@ -0,0 +1,85 @@ +/* + * 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.binding.sca.axis2.impl; + +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.SCABinding; +import org.apache.tuscany.sca.binding.ws.WebServiceBinding; +import org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvider; +import org.apache.tuscany.sca.host.http.ServletHost; +import org.apache.tuscany.sca.invocation.MessageFactory; +import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; + +/** + * A specialization of the Axis2BindingProvider that just switches in the SCABinding model + * element when it is required. The SCABinding is required as the service binding provider + * finds the service wire based in the binding + * + * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $ + */ +public class Axis2SCAServiceProvider extends Axis2ServiceProvider { + + private SCABinding binding; + + /** + * Switch in the fake ws binding + * + * @param component + * @param service + * @param binding + * @param wsBinding + * @param servletHost + * @param messageFactory + */ + public Axis2SCAServiceProvider(RuntimeComponent component, + RuntimeComponentService service, + SCABinding binding, + WebServiceBinding wsBinding, + ServletHost servletHost, + MessageFactory messageFactory, + Map> policyHandlerClassnames) { + + super(component, + service, + wsBinding, + servletHost, + messageFactory, + policyHandlerClassnames); + + this.binding = binding; + } + + /** + * Return the sca binding as wires will be registered against this rather + * than against the wsBinding that the Axis2SCAServiceProvider is + * expecting + * + * @return the binding + */ + @Override + protected Binding getBinding(){ + return binding; + } +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory new file mode 100644 index 0000000000..1b369cde06 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory @@ -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 binding extension +org.apache.tuscany.sca.binding.sca.axis2.impl.Axis2SCABindingProviderFactory;model=org.apache.tuscany.sca.binding.sca.DistributedSCABinding diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java new file mode 100644 index 0000000000..40d64be9b1 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java @@ -0,0 +1,73 @@ +/* + * 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.binding.sca.axis2; + + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientCallbackOnewayRemoteImpl; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class AsynchTestCase { + + public static TestNode nodeA; + public static TestNode nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + + try { + // create and start domains + nodeA = new TestNode("nodeG"); + nodeB = new TestNode("nodeH"); + + nodeA.start(); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + } + + @Test + public void testHelloWorldAsynch() throws Exception { + HelloWorldClient helloWorldClientB; + helloWorldClientB = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote"); + helloWorldClientB.getGreetings("fred"); + System.out.println("Sleeping ..."); + Thread.sleep(2000); + System.out.println("... Done"); + Assert.assertEquals("callback fred", HelloWorldClientCallbackOnewayRemoteImpl.result ); + + } + + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BindingScaEndpointResolverFactoryImpl.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BindingScaEndpointResolverFactoryImpl.java new file mode 100644 index 0000000000..b345e563e3 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BindingScaEndpointResolverFactoryImpl.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.sca.axis2; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.assembly.SCABinding; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.endpointresolver.EndpointResolver; +import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory; + +/** + * The factory for creating endpoint Binding providers + * + * @version $Rev$ $Date$ + */ +public class BindingScaEndpointResolverFactoryImpl implements EndpointResolverFactory { + + private ExtensionPointRegistry extensionPoints; + + public BindingScaEndpointResolverFactoryImpl(ExtensionPointRegistry extensionPoints) { + this.extensionPoints = extensionPoints; + } + + public EndpointResolver createEndpointResolver(Endpoint endpoint, Binding binding) { + + return new BindingScaEndpointResolverImpl(extensionPoints, endpoint, binding); + } + + public Class getModelType() { + return SCABinding.class; + } +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BindingScaEndpointResolverImpl.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BindingScaEndpointResolverImpl.java new file mode 100644 index 0000000000..472e85116e --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BindingScaEndpointResolverImpl.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.binding.sca.axis2; + + +import java.util.logging.Logger; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.assembly.SCABinding; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.endpointresolver.EndpointResolver; + +/** + * The endpoint resolver allows unresolved endpoints to be plumbed into + * the runtime start and message send processing as a hook to late resolution + * of target services + * + * @version $Rev$ $Date$ + */ +public class BindingScaEndpointResolverImpl implements EndpointResolver { + + private final static Logger logger = Logger.getLogger(BindingScaEndpointResolverImpl.class.getName()); + + private Endpoint endpoint; + private SCABinding binding; + + public BindingScaEndpointResolverImpl(ExtensionPointRegistry extensionPoints, + Endpoint endpoint, + Binding binding) { + this.endpoint = endpoint; + this.binding = (SCABinding)binding; + } + + public void start(){ + // do nothing + } + + public void resolve() { + if (endpoint.isUnresolved()){ + // pretend to resolve the endpoint. In this test case to what we know + // it should be + logger.info("Fixing up endpoint soure binding"); + endpoint.setSourceBinding(endpoint.getCandidateBindings().get(0)); + endpoint.getSourceBinding().setURI("http://localhost:8085/BHelloWorldServiceRemote"); + } + } + + public void stop(){ + // do nothing + } +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java new file mode 100644 index 0000000000..76dbc5a5c7 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java @@ -0,0 +1,77 @@ +/* + * 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.binding.sca.axis2; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class CallbackTestCase { + + public static TestNode nodeA; + public static TestNode nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + + try { + // create and start domains + nodeA = new TestNode("nodeE"); + nodeB = new TestNode("nodeF"); + + nodeA.start(); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + } + + //@Test + public void testKeepServerRunning() throws Exception { + System.out.println("press enter to continue"); + System.in.read(); + } + + @Test + public void testHelloWorldCallbackLocal() throws Exception { + HelloWorldClient helloWorldClientB; + helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientCallbackLocal"); + Assert.assertEquals("Hello callback fred", helloWorldClientB.getGreetings("fred")); + } + + @Test + public void testHelloWorldCallbackRemote() throws Exception { + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote"); + Assert.assertEquals("Hello callback fred", helloWorldClientA.getGreetings("fred")); + } +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java new file mode 100644 index 0000000000..2deb62e6c4 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.sca.axis2; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class PromotionTestCase { + + public static TestNode nodeA; + public static TestNode nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + + try { + // create and start domains + nodeA = new TestNode("nodeC"); + nodeB = new TestNode("nodeD"); + + nodeA.start(); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + } + + @Test + public void testHelloWorldPromotion() throws Exception { + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientRemotePromotion"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + + } + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java new file mode 100644 index 0000000000..2d2a23d7df --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java @@ -0,0 +1,105 @@ +/* + * 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.binding.sca.axis2; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.osoa.sca.ServiceUnavailableException; + +public class SimpleTestCase { + + public static TestNode nodeA; + public static TestNode nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + + try { + // create and start domains + nodeA = new TestNode("nodeA"); + nodeB = new TestNode("nodeB"); + + nodeA.start(); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + } + + @Test + public void testHelloWorldLocal() throws Exception { + HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientLocal"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + + } + + @Test + public void testHelloWorldRemote() throws Exception { + + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientRemote"); + + try { + helloWorldClientA.getGreetings("fred"); + } catch (ServiceUnavailableException ex){ + Assert.fail(); + } + } + + @Test + public void testHelloWorldLocalAndRemote() throws Exception { + HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientLocalAndRemote"); + HelloWorldClient helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientLocalAndRemote"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + Assert.assertEquals(helloWorldClientB.getGreetings("fred"), "Hello fred"); + } + + @Test + public void testHelloWorldMultipleServices() throws Exception { + HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleServices"); + HelloWorldClient helloWorldClientA2 = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleServices2"); + HelloWorldClient helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientMultipleServices"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + Assert.assertEquals(helloWorldClientA2.getGreetings("fred"), "Hello fred"); + Assert.assertEquals(helloWorldClientB.getGreetings("fred"), "Hello fred"); + } + + @Test + public void testHelloWorldMultipleBindings() throws Exception { + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleBindings"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + + } + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java new file mode 100644 index 0000000000..1c1a6ecd67 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java @@ -0,0 +1,232 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.sca.axis2; + +import java.net.URL; +import java.util.logging.Logger; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.assembly.AssemblyFactory; +import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.ComponentService; +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.CompositeService; +import org.apache.tuscany.sca.assembly.SCABinding; +import org.apache.tuscany.sca.assembly.SCABindingFactory; +import org.apache.tuscany.sca.assembly.xml.Constants; +import org.apache.tuscany.sca.contribution.Contribution; +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.contribution.service.ContributionService; +import org.apache.tuscany.sca.core.context.ServiceReferenceImpl; +import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentContext; +import org.apache.tuscany.sca.runtime.RuntimeComponentReference; +import org.osoa.sca.ServiceReference; +import org.osoa.sca.ServiceRuntimeException; + +/** + * The very minimum node implementation to get these tests going without creating a dependency on + * any runtime/hosting implementation + * + * @version $Rev: 552343 $ $Date: 2007-09-20 14:53:40 +0100 (Thu, 20 Sep 2007) $ + */ +public class TestNode { + + private static final Logger logger = Logger.getLogger(TestNode.class.getName()); + + private String nodeName; + private ReallySmallRuntime nodeRuntime; + + private ClassLoader cl = TestNode.class.getClassLoader(); + + private Composite nodeComposite = null; + private Composite appComposite = null; + + public TestNode(String nodeName) + throws Exception { + this.nodeName = nodeName; + + try { + + // create and start domainA + nodeRuntime = new ReallySmallRuntime(cl); + nodeRuntime.start(); + + // Create an in-memory domain level composite + AssemblyFactory assemblyFactory = nodeRuntime.getAssemblyFactory(); + nodeComposite = assemblyFactory.createComposite(); + nodeComposite.setName(new QName(Constants.SCA10_NS, "domain")); + nodeComposite.setURI("http://localhost"); + + // add the top level composite into the composite activator + nodeRuntime.getCompositeActivator().setDomainComposite(nodeComposite); + + // add a contribution to the domain + ContributionService contributionService = nodeRuntime.getContributionService(); + + // find the current directory as a URL. This is where our contribution + // will come from + URL contributionURL = Thread.currentThread().getContextClassLoader().getResource(nodeName + "/"); + + // Contribute the SCA application + Contribution contribution = contributionService.contribute("http://calculator", contributionURL, null, false); + appComposite = contribution.getDeployables().get(0); + + // Add the deployable composite to the domain + nodeComposite.getIncludes().add(appComposite); + nodeRuntime.buildComposite(appComposite); + nodeRuntime.getCompositeActivator().activate(appComposite); + + + } catch (Exception ex) { + System.err.println("Exception when creating node " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + public void start() { + + try { + nodeRuntime.getCompositeActivator().start(appComposite); + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + } + + } + + public void stop() { + try { + nodeRuntime.stop(); + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + } + } + + public B getService(Class businessInterface, String serviceName) { + ServiceReference serviceReference = getServiceReference(businessInterface, serviceName); + if (serviceReference == null) { + throw new ServiceRuntimeException("Service not found: " + serviceName); + } + return serviceReference.getService(); + } + + private ServiceReference createServiceReference(Class businessInterface, String targetURI) { + try { + AssemblyFactory assemblyFactory = nodeRuntime.getAssemblyFactory(); + Composite composite = assemblyFactory.createComposite(); + composite.setName(new QName(Constants.SCA10_TUSCANY_NS, "default")); + RuntimeComponent component = (RuntimeComponent)assemblyFactory.createComponent(); + component.setName("default"); + component.setURI("default"); + nodeRuntime.getCompositeActivator().configureComponentContext(component); + composite.getComponents().add(component); + RuntimeComponentReference reference = (RuntimeComponentReference)assemblyFactory.createComponentReference(); + reference.setName("default"); + ModelFactoryExtensionPoint factories = + nodeRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class); + JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class); + InterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract(); + interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface)); + reference.setInterfaceContract(interfaceContract); + component.getReferences().add(reference); + reference.setComponent(component); + SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class); + SCABinding binding = scaBindingFactory.createSCABinding(); + binding.setURI(targetURI); + reference.getBindings().add(binding); + return new ServiceReferenceImpl(businessInterface, component, reference, binding, nodeRuntime + .getProxyFactory(), nodeRuntime.getCompositeActivator()); + } catch (Exception e) { + throw new ServiceRuntimeException(e); + } + } + + public ServiceReference getServiceReference(Class businessInterface, String name) { + + // Extract the component name + String componentName; + String serviceName; + int i = name.indexOf('/'); + if (i != -1) { + componentName = name.substring(0, i); + serviceName = name.substring(i + 1); + + } else { + componentName = name; + serviceName = null; + } + + // Lookup the component in the domain + + Component component = null; + + for (Composite composite: nodeComposite.getIncludes()) { + for (Component componentLoop: composite.getComponents()) { + if (componentLoop.getName().equals(componentName)) { + component = componentLoop; + break; + } + } + } + if (component == null) { + // The component is not local in the partition, try to create a remote service ref + return createServiceReference(businessInterface, name); + } + RuntimeComponentContext componentContext = null; + + // If the component is a composite, then we need to find the + // non-composite component that provides the requested service + if (component.getImplementation() instanceof Composite) { + for (ComponentService componentService : component.getServices()) { + if (serviceName == null || serviceName.equals(componentService.getName())) { + CompositeService compositeService = (CompositeService)componentService.getService(); + if (compositeService != null) { + if (serviceName != null) { + serviceName = "$promoted$." + serviceName; + } + componentContext = + ((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext(); + return componentContext.createSelfReference(businessInterface, compositeService + .getPromotedService()); + } + break; + } + } + // No matching service is found + throw new ServiceRuntimeException("Composite service not found: " + name); + } else { + componentContext = ((RuntimeComponent)component).getComponentContext(); + if (serviceName != null) { + return componentContext.createSelfReference(businessInterface, serviceName); + } else { + return componentContext.createSelfReference(businessInterface); + } + } + } + +} + diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.java new file mode 100644 index 0000000000..1a2788ac74 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.java @@ -0,0 +1,29 @@ +/* + * 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.binding.sca.axis2.helloworld; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface HelloWorldCallbackRemote { + + String getGreetingsCallbackRemote(String s); + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..e4d36ac78b --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.java @@ -0,0 +1,27 @@ +/* + * 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.binding.sca.axis2.helloworld; + + +public interface HelloWorldClient { + + String getGreetings(String s); + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.java new file mode 100644 index 0000000000..a83fcb3069 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.sca.axis2.helloworld; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; + +@Remotable +@Callback(HelloWorldCallbackRemote.class) +public interface HelloWorldServiceCallbackOnewayRemote { + + @OneWay + void getGreetingsRemote(String s); + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.java new file mode 100644 index 0000000000..c41548ec51 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.java @@ -0,0 +1,31 @@ +/* + * 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.binding.sca.axis2.helloworld; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Remotable; + +@Remotable +@Callback(HelloWorldCallbackRemote.class) +public interface HelloWorldServiceCallbackRemote { + + String getGreetingsRemote(String s); + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.java new file mode 100644 index 0000000000..7b8e00eb2a --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.java @@ -0,0 +1,27 @@ +/* + * 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.binding.sca.axis2.helloworld; + + +public interface HelloWorldServiceLocal { + + String getGreetingsLocal(String s); + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.java new file mode 100644 index 0000000000..62d61e4fff --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.java @@ -0,0 +1,29 @@ +/* + * 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.binding.sca.axis2.helloworld; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface HelloWorldServiceRemote { + + String getGreetingsRemote(String s); + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.java new file mode 100644 index 0000000000..2dcc8cc64b --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.java @@ -0,0 +1,29 @@ +/* + * 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.binding.sca.axis2.helloworld; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface HelloWorldServiceRemote2 { + + String getGreetingsRemote2(String s); + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java new file mode 100644 index 0000000000..8e7d2f8023 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackOnewayRemote; +import org.osoa.sca.annotations.Reference; + +public class HelloWorldClientCallbackOnewayRemoteImpl implements HelloWorldClient { + + public static String result; + + @Reference + public HelloWorldServiceCallbackOnewayRemote helloWorldService; + + public String getGreetings(String s) { + helloWorldService.getGreetingsRemote(s); + return null; + } + + public String getGreetingsCallbackRemote(String s) { + result = "callback " + s; + return result; + } + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java new file mode 100644 index 0000000000..7d07c4ff43 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackRemote; +import org.osoa.sca.annotations.Reference; + +public class HelloWorldClientCallbackRemoteImpl implements HelloWorldClient { + + public static String result; + + @Reference + public HelloWorldServiceCallbackRemote helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsRemote(s); + } + + public String getGreetingsCallbackRemote(String s) { + result = "callback " + s; + return result; + } + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.java new file mode 100644 index 0000000000..7098f10622 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal; +import org.osoa.sca.annotations.Reference; + +public class HelloWorldClientLocalImpl implements HelloWorldClient { + + @Reference + public HelloWorldServiceLocal helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsLocal(s); + } + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.java new file mode 100644 index 0000000000..07ae00bd31 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote2; +import org.osoa.sca.annotations.Reference; + +public class HelloWorldClientRemote2Impl implements HelloWorldClient { + + @Reference + public HelloWorldServiceRemote2 helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsRemote2(s); + } + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.java new file mode 100644 index 0000000000..36854cb7b8 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote; +import org.osoa.sca.annotations.Reference; + +public class HelloWorldClientRemoteImpl implements HelloWorldClient { + + @Reference + public HelloWorldServiceRemote helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsRemote(s); + } + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java new file mode 100644 index 0000000000..fd3e3a1158 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldCallbackRemote; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackOnewayRemote; +import org.osoa.sca.annotations.Callback; + + +public class HelloWorldServiceCallbackOnewayRemoteImpl implements HelloWorldServiceCallbackOnewayRemote { + + @Callback + protected HelloWorldCallbackRemote theCallback; + + public void getGreetingsRemote(String s) { + theCallback.getGreetingsCallbackRemote(s); + } + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java new file mode 100644 index 0000000000..3400e97447 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldCallbackRemote; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackRemote; +import org.osoa.sca.annotations.Callback; + +public class HelloWorldServiceCallbackRemoteImpl implements HelloWorldServiceCallbackRemote { + + @Callback + protected HelloWorldCallbackRemote theCallback; + + public String getGreetingsRemote(String s) { + return "Hello " + theCallback.getGreetingsCallbackRemote(s); + } + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.java new file mode 100644 index 0000000000..20dd97b74a --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal; + +public class HelloWorldServiceLocalImpl implements HelloWorldServiceLocal { + + public String getGreetingsLocal(String s) { + return "Hello " + s; + } + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java new file mode 100644 index 0000000000..5f8ccf9466 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.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.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote2; +import org.osoa.sca.annotations.Service; + +@Service(interfaces={HelloWorldServiceRemote.class, HelloWorldServiceRemote2.class, HelloWorldServiceLocal.class} ) +public class HelloWorldServiceMultipleServicesImpl implements HelloWorldServiceLocal, HelloWorldServiceRemote, HelloWorldServiceRemote2 { + + public String getGreetingsLocal(String s) { + return "Hello " + s; + } + + public String getGreetingsRemote(String s) { + return "Hello " + s; + } + + public String getGreetingsRemote2(String s) { + return "Hello " + s; + } +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.java b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.java new file mode 100644 index 0000000000..b25aebd9df --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote; + +public class HelloWorldServiceRemoteImpl implements HelloWorldServiceRemote { + + public String getGreetingsRemote(String s) { + return "Hello " + s; + } + +} diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory new file mode 100644 index 0000000000..5e4fd566c3 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory @@ -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 binding extension +org.apache.tuscany.sca.binding.sca.axis2.BindingScaEndpointResolverFactoryImpl;model=org.apache.tuscany.sca.assembly.SCABinding diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeA/HelloWorld.composite b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeA/HelloWorld.composite new file mode 100644 index 0000000000..093258051e --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeA/HelloWorld.composite @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeA/META-INF/sca-contribution.xml b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeA/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..d6b9e82250 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeA/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeB/HelloWorld.composite b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeB/HelloWorld.composite new file mode 100644 index 0000000000..8cf7230ed5 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeB/HelloWorld.composite @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeB/META-INF/sca-contribution.xml b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeB/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..d6b9e82250 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeB/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorld.composite b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorld.composite new file mode 100644 index 0000000000..066727f76d --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorld.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorldComponent.composite b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorldComponent.composite new file mode 100644 index 0000000000..485e0815d2 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorldComponent.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeC/META-INF/sca-contribution.xml b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeC/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..d6b9e82250 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeC/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorld.composite b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorld.composite new file mode 100644 index 0000000000..a5a4f04cb5 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorld.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorldComponent.composite b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorldComponent.composite new file mode 100644 index 0000000000..bf30bdf42d --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorldComponent.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeD/META-INF/sca-contribution.xml b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeD/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..d6b9e82250 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeD/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeE/HelloWorld.composite b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeE/HelloWorld.composite new file mode 100644 index 0000000000..b519793290 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeE/HelloWorld.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeE/META-INF/sca-contribution.xml b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeE/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..d6b9e82250 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeE/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeF/HelloWorld.composite b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeF/HelloWorld.composite new file mode 100644 index 0000000000..20a6c54e6e --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeF/HelloWorld.composite @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeF/META-INF/sca-contribution.xml b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeF/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..d6b9e82250 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeF/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeG/HelloWorld.composite b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeG/HelloWorld.composite new file mode 100644 index 0000000000..a76008d0c5 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeG/HelloWorld.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeG/META-INF/sca-contribution.xml b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeG/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..d6b9e82250 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeG/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeH/HelloWorld.composite b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeH/HelloWorld.composite new file mode 100644 index 0000000000..0c22af22ab --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeH/HelloWorld.composite @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + diff --git a/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeH/META-INF/sca-contribution.xml b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeH/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..d6b9e82250 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/binding-sca-axis2/src/test/resources/nodeH/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file -- cgit v1.2.3