summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:07:19 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:07:19 +0000
commit6fadbc9cd1fcf03d0b3630f772d91df149b70428 (patch)
tree32752e491abb97fc8ef4f246455e3b5fd2814862 /sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension
parent5559ef5edbf8d3616f7a4b497b2a459b0ee4082b (diff)
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835123 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension')
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/README74
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/build.xml51
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/pom.xml78
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java29
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java33
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java34
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java84
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java131
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java48
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java71
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java58
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java71
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java78
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java41
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java36
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java43
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java78
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java48
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java26
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java29
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java33
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java43
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java54
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java78
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java52
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory19
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor21
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema19
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd36
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/java/echo/Echo.java29
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java50
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java50
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/resources/EchoBinding.composite41
-rw-r--r--sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/resources/definitions.xml198
39 files changed, 2146 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/DISCLAIMER b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/DISCLAIMER
@@ -0,0 +1,8 @@
+Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/LICENSE b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/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/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/NOTICE b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/README b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/README
new file mode 100644
index 0000000000..94716b151f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/README
@@ -0,0 +1,74 @@
+Binding Echo Sample
+===================
+This sample demonstrates how new bindings are constructed for Apache Tuscany
+SCA.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you want to try out the echo binding that this sample provides
+please see the binding-echo sample that provides the necessary client and
+application code to bring up an application that uses this binding
+
+Sample Overview
+---------------
+This sample contains a implementation of an SCA binding that simply echoes back
+any messages that are sent to it.
+
+binding-echo-extension/
+ src/
+ main/
+ java/
+ echo/ - The binding interfaces
+ impl/ - The bindings model classes
+ provider/ - The bindings runtime classes
+ server/ - A dummy server that the binding is plugged into
+ resources/
+ META-INF/
+ services/ - The extension declaration
+ test/
+ java/
+ echo/ - test code
+ resources/
+ EchoBinding.composite - the SCA assembly used by the unit test
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building The Sample Using Ant
+-----------------------------
+With the binary distribution the sample can be built using Ant as
+follows
+
+cd binding-echo-extension
+ant compile
+
+See the binding-echo sample to run a sample that uses this binding.
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd binding-echo-extension
+mvn
+
+Maven will also test that the sample extension built properly. You should see
+the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running echo.EchoServiceTestCase
+Returned message: oof
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.011 sec
+Running echo.EchoReferenceTestCase
+Returned message: oof
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.06 sec
+
+Results :
+
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+
+
+This shows that the Junit test cases have run successfully.
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/build.xml b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/build.xml
new file mode 100644
index 0000000000..5df5981bea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/build.xml
@@ -0,0 +1,51 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project name="binding-echo-extension" default="compile">
+ <property name="test.jar" value="sample-binding-echo-extension.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/pom.xml b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/pom.xml
new file mode 100644
index 0000000000..44e73b448a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/pom.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.0.1-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-binding-echo-extension</artifactId>
+ <name>Apache Tuscany SCA Echo Binding Extension Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.0.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.0.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.0.1-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.0.1-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java
new file mode 100644
index 0000000000..3fe1598e0d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/EchoBinding.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 echo;
+
+import org.apache.tuscany.sca.assembly.Binding;
+
+/**
+ * A model for the sample Echo binding.
+ */
+public interface EchoBinding extends Binding {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java
new file mode 100644
index 0000000000..0f6fee82be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.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 echo;
+
+/**
+ * A factory for the sample Echo binding model.
+ */
+public interface EchoBindingFactory {
+
+ /**
+ * Creates a new Echo binding.
+ *
+ * @return a new Echo binding
+ */
+ EchoBinding createEchoBinding();
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java
new file mode 100644
index 0000000000..af759dbf93
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java
@@ -0,0 +1,34 @@
+/*
+ * 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 echo.impl;
+
+import echo.EchoBinding;
+import echo.EchoBindingFactory;
+
+/**
+ * A factory for the sample Echo binding model.
+ */
+public class EchoBindingFactoryImpl implements EchoBindingFactory {
+
+ public EchoBinding createEchoBinding() {
+ return new EchoBindingImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java
new file mode 100644
index 0000000000..d8156f9647
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java
@@ -0,0 +1,84 @@
+/*
+ * 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 echo.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+import echo.EchoBinding;
+
+/**
+ * Implementation of the Echo binding model.
+ */
+public class EchoBindingImpl implements EchoBinding, PolicySetAttachPoint {
+
+ private String name;
+ private String uri;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private IntentAttachPointType bindingType = null;
+
+ public IntentAttachPointType getType() {
+ return bindingType;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ this.bindingType = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public boolean isUnresolved() {
+ // The sample binding is always resolved
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The sample binding is always resolved
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
new file mode 100644
index 0000000000..45c2d7c033
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package echo.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.impl.BindingTypeImpl;
+import org.apache.tuscany.sca.policy.impl.IntentAttachPointTypeFactoryImpl;
+
+import echo.EchoBinding;
+import echo.EchoBindingFactory;
+
+/**
+ * A processor for <binding.echo> elements.
+ */
+public class EchoBindingProcessor implements StAXArtifactProcessor<EchoBinding> {
+
+ private QName BINDING_ECHO = new QName("http://echo", "binding.echo");
+
+ private final EchoBindingFactory factory;
+ private PolicyAttachPointProcessor policyProcessor;
+
+ public EchoBindingProcessor(EchoBindingFactory factory, PolicyFactory policyFactory) {
+ this.factory = factory;
+ this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ }
+
+ public QName getArtifactType() {
+ return BINDING_ECHO;
+ }
+
+ public Class<EchoBinding> getModelType() {
+ return EchoBinding.class;
+ }
+
+ public EchoBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ EchoBinding echoBinding = factory.createEchoBinding();
+
+ IntentAttachPointType bindingType = new IntentAttachPointTypeFactoryImpl().createBindingType();
+ bindingType.setName(getArtifactType());
+ bindingType.setUnresolved(true);
+ ((PolicySetAttachPoint)echoBinding).setType(bindingType);
+
+
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null) {
+ echoBinding.setName(name);
+ }
+
+ String uri = reader.getAttributeValue(null, "uri");
+ if (uri != null) {
+ echoBinding.setURI(uri);
+ }
+
+ policyProcessor.readPolicies(echoBinding, reader);
+
+ return echoBinding;
+ }
+
+ public void write(EchoBinding echoBinding, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ policyProcessor.writePolicyPrefixes(echoBinding, writer);
+ writer.writeStartElement(BINDING_ECHO.getNamespaceURI(), BINDING_ECHO.getLocalPart());
+ policyProcessor.writePolicyAttributes(echoBinding, writer);
+
+ if (echoBinding.getName() != null) {
+ writer.writeAttribute("name", echoBinding.getName());
+ }
+
+ if (echoBinding.getURI() != null) {
+ writer.writeAttribute("uri", echoBinding.getURI());
+ }
+
+ writer.writeEndElement();
+ }
+
+ public void resolve(EchoBinding echoBinding, ModelResolver resolver) throws ContributionResolveException {
+ PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)echoBinding;
+ List<Intent> requiredIntents = new ArrayList<Intent>();
+ Intent resolvedIntent = null;
+ for ( Intent intent : policySetAttachPoint.getRequiredIntents() ) {
+ resolvedIntent = resolver.resolveModel(Intent.class, intent);
+ requiredIntents.add(resolvedIntent);
+ }
+ policySetAttachPoint.getRequiredIntents().clear();
+ policySetAttachPoint.getRequiredIntents().addAll(requiredIntents);
+
+ List<PolicySet> resolvedPolicySets = new ArrayList<PolicySet>();
+ PolicySet resolvedPolicySet = null;
+ for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) {
+ resolvedPolicySet = resolver.resolveModel(PolicySet.class, policySet);
+ resolvedPolicySets.add(resolvedPolicySet);
+ }
+ policySetAttachPoint.getPolicySets().clear();
+ policySetAttachPoint.getPolicySets().addAll(resolvedPolicySets);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java
new file mode 100644
index 0000000000..91697fcd9a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo.provider;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Invoker for the sample echo binding.
+ */
+class EchoBindingInvoker implements Invoker {
+
+ EchoBindingInvoker() {
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ System.out.println("Passing thro invoker...");
+ Object[] args = msg.getBody();
+
+ // echo back the first parameter, a real binding would invoke some API for flowing the request
+ Object result = args[0];
+
+ msg.setBody(result);
+
+ } catch (Exception e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java
new file mode 100644
index 0000000000..485386cea8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java
@@ -0,0 +1,71 @@
+/*
+ * 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 echo.provider;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+import echo.provider.policy.PolicyHandler;
+import echo.provider.policy.EncryptionPolicyHandler;
+
+/**
+ * Invoker that applies policies before invocation for the sample echo binding.
+ */
+public class EchoBindingPoliciedInvoker implements Invoker {
+ List<PolicySet> policies = null;
+ Map<QName, PolicyHandler> policyHandlers = new HashMap<QName, PolicyHandler>();
+
+ public EchoBindingPoliciedInvoker(List<PolicySet> policies) {
+ this.policies = policies;
+ policyHandlers.put(new QName("http://sample/policy","EncryptionPolicy"),
+ new EncryptionPolicyHandler());
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object[] args = msg.getBody();
+
+ applyPolicies(args);
+
+ // echo back the first parameter, a real binding would invoke some API for flowing the request
+ Object result = args[0];
+
+ msg.setBody(result);
+
+ } catch (Exception e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+ private void applyPolicies(Object[] args) throws Exception {
+ for ( PolicySet policySet : policies ) {
+ PolicyHandler policyHandler = policyHandlers.get(policySet.getName());
+ policyHandler.applyPolicy(args, policySet);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java
new file mode 100644
index 0000000000..ba74d8f99a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package echo.provider;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+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;
+
+import echo.EchoBinding;
+
+
+/**
+ * Implementation of the Echo binding model.
+ */
+public class EchoBindingProviderFactory implements BindingProviderFactory<EchoBinding> {
+
+ private MessageFactory messageFactory;
+
+ public EchoBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ ModelFactoryExtensionPoint factories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ this.messageFactory = factories.getFactory(MessageFactory.class);
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, EchoBinding binding) {
+ return new EchoReferenceBindingProvider(component, reference, binding);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, EchoBinding binding) {
+ return new EchoServiceBindingProvider(component, service, binding, messageFactory);
+ }
+
+ public Class<EchoBinding> getModelType() {
+ return EchoBinding.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java
new file mode 100644
index 0000000000..0efc319af9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java
@@ -0,0 +1,71 @@
+/*
+ * 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 echo.provider;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+import echo.EchoBinding;
+
+/**
+ * Implementation of the Echo binding provider.
+ */
+class EchoReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private RuntimeComponentReference reference;
+ private EchoBinding binding;
+
+ EchoReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ EchoBinding binding) {
+ this.reference = reference;
+ this.binding = binding;
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ if (binding instanceof PolicySetAttachPoint) {
+ PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)binding;
+ if ( !policySetAttachPoint.getPolicySets().isEmpty() ){
+ return new EchoBindingPoliciedInvoker(policySetAttachPoint.getPolicySets());
+ }
+ }
+ return new EchoBindingInvoker();
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java
new file mode 100644
index 0000000000..1cd1e5af4e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java
@@ -0,0 +1,78 @@
+/*
+ * 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 echo.provider;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+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.runtime.RuntimeWire;
+
+import echo.EchoBinding;
+import echo.server.EchoServer;
+import echo.server.EchoServiceListener;
+
+/**
+ * Implementation of the Echo binding provider.
+ */
+class EchoServiceBindingProvider implements ServiceBindingProvider {
+
+ private RuntimeComponent component;
+ private RuntimeComponentService service;
+ private EchoBinding binding;
+ private MessageFactory messageFactory;
+
+ EchoServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service, EchoBinding binding, MessageFactory messageFactory) {
+ this.component = component;
+ this.service = service;
+ this.binding = binding;
+ this.messageFactory = messageFactory;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return service.getInterfaceContract();
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+
+ RuntimeComponentService componentService = (RuntimeComponentService) service;
+ RuntimeWire wire = componentService.getRuntimeWire(binding);
+ InvocationChain chain = wire.getInvocationChains().get(0);
+
+ // Register with the hosting server
+ String uri = binding.getURI();
+ EchoServer.getServer().register(uri, new EchoServiceListener(chain.getHeadInvoker(), messageFactory));
+ }
+
+ public void stop() {
+
+ // Unregister from the hosting server
+ String uri = component.getURI() + "/" + binding.getName();
+ EchoServer.getServer().unregister(uri);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java
new file mode 100644
index 0000000000..33dc761aa4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.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 echo.provider.policy;
+
+/**
+ */
+public class EchoBindingEncryptionPolicy extends EchoBindingPolicy {
+
+ private String encryptionStrategyClassName;
+ private Class<? extends EncryptionStrategy> strategyClass;
+
+ public String getEncryptionStrategyClassName() {
+ return encryptionStrategyClassName;
+ }
+ public void setEncryptionStrategyClassName(String encryptionStrategyClassName) {
+ this.encryptionStrategyClassName = encryptionStrategyClassName;
+ }
+ public Class<? extends EncryptionStrategy> getStrategyClass() {
+ return strategyClass;
+ }
+ public void setStrategyClass(Class<? extends EncryptionStrategy> strategy) {
+ this.strategyClass = strategy;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java
new file mode 100644
index 0000000000..49d195395b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.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 echo.provider.policy;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+
+
+/**
+ *
+ */
+public class EchoBindingEncryptionPolicyProcessor extends EchoBindingPolicyProcessor<EchoBindingEncryptionPolicy> {
+
+ public EchoBindingEncryptionPolicyProcessor(ModelFactoryExtensionPoint modelFactories) {
+ }
+
+ public Class<EchoBindingEncryptionPolicy> getModelType() {
+ return EchoBindingEncryptionPolicy.class;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java
new file mode 100644
index 0000000000..7d38e3b7a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.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 echo.provider.policy;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Policy;
+
+/**
+
+ */
+public class EchoBindingPolicy implements Policy {
+ private boolean unresolved = true;
+
+ public QName getSchemaName() {
+ return new QName("http://sample/policy","echoBindingPolicy");
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java
new file mode 100644
index 0000000000..72b8002238
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java
@@ -0,0 +1,78 @@
+/*
+ * 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 echo.provider.policy;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ *
+ */
+public abstract class EchoBindingPolicyProcessor<T extends EchoBindingPolicy> implements StAXArtifactProcessor<T> {
+ public static final String ENCRYPTION = "Encryption";
+
+ public QName getArtifactType() {
+ return new QName("http://sample/policy", "echoBindingPolicy");
+ }
+
+ public T read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null && name.equals(ENCRYPTION)) {
+ EchoBindingEncryptionPolicy policy = new EchoBindingEncryptionPolicy();
+ policy.setEncryptionStrategyClassName(reader.getAttributeValue(null, "strategy"));
+ return (T)policy;
+ }
+ return null;
+ }
+
+ public void write(T arg0, XMLStreamWriter arg1) throws ContributionWriteException, XMLStreamException {
+ }
+
+ public void resolve(T policy, ModelResolver resolver) throws ContributionResolveException {
+ if (policy instanceof EchoBindingEncryptionPolicy) {
+ EchoBindingEncryptionPolicy ePolicy = (EchoBindingEncryptionPolicy)policy;
+
+ ClassReference classReference = new ClassReference(ePolicy.getEncryptionStrategyClassName());
+ classReference = resolver.resolveModel(ClassReference.class, classReference);
+ Class javaClass = classReference != null ? classReference.getJavaClass() : null;
+ if (javaClass == null) {
+ //throw new ContributionResolveException(new ClassNotFoundException(ePolicy.getEncryptionStrategyClass()));
+ }
+ //ePolicy.setStrategyClass(javaClass);
+ //FIXME: need to resolve this thro resolver
+ try {
+ ePolicy.setStrategyClass((Class<? extends EncryptionStrategy>)Class.forName(ePolicy
+ .getEncryptionStrategyClassName()));
+ } catch (Exception e) {
+ throw new ContributionResolveException(e);
+ }
+ ePolicy.setStrategyClass(ePolicy.getStrategyClass());
+ ePolicy.setUnresolved(false);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java
new file mode 100644
index 0000000000..deda8d9744
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo.provider.policy;
+
+import org.apache.tuscany.sca.policy.Policy;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Sample policy handler
+ */
+public class EncryptionPolicyHandler implements PolicyHandler {
+
+ public void applyPolicy(Object msg, PolicySet policySet) throws Exception {
+ for ( Object aPolicy : policySet.getPolicies() ) {
+ if ( aPolicy instanceof EchoBindingEncryptionPolicy ) {
+ encrypt(msg, (EchoBindingEncryptionPolicy)aPolicy);
+ }
+ }
+ }
+
+ private void encrypt(Object msg, EchoBindingEncryptionPolicy policy) throws Exception {
+ if ( !policy.isUnresolved() && msg instanceof Object[] ) {
+ EncryptionStrategy strategy = policy.getStrategyClass().newInstance();
+ Object[] msgArgs = (Object[])msg;
+ for ( int count = 0 ; count < msgArgs.length ; ++count ) {
+ msgArgs[count] = strategy.encryptMessage(msgArgs[count]);
+ }
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java
new file mode 100644
index 0000000000..ffadfc7fff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java
@@ -0,0 +1,26 @@
+/*
+ * 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 echo.provider.policy;
+
+/**
+
+ */
+public interface EncryptionStrategy {
+ Object encryptMessage(Object msg);
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java
new file mode 100644
index 0000000000..6fa5f26977
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.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 echo.provider.policy;
+
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Sample Policy Handler Interface
+ *
+ */
+public interface PolicyHandler {
+ void applyPolicy(Object msg, PolicySet policySet) throws Exception;
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java
new file mode 100644
index 0000000000..cf55b36fc2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.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 echo.provider.policy;
+
+/**
+ */
+public class ReverseEncryptionStrategy implements EncryptionStrategy {
+
+ public Object encryptMessage(Object msg) {
+ if ( msg instanceof String ) {
+ StringBuffer sb = new StringBuffer((String)msg);
+ msg = sb.reverse().toString();
+ }
+ return msg;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java
new file mode 100644
index 0000000000..ac610cfb51
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.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 echo.provider.policy;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Policy;
+
+/**
+
+ */
+public class WSPolicy implements Policy {
+ private boolean unresolved = true;
+
+ public QName getSchemaName() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java
new file mode 100644
index 0000000000..fcb250b444
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo.provider.policy;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+public class WSPolicyProcessor implements StAXArtifactProcessor<WSPolicy> {
+
+ public QName getArtifactType() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public WSPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ //FIXME Implement this method
+ return new WSPolicy();
+ }
+
+ public void write(WSPolicy wsPolicy, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+ //FIXME Implement this method
+ }
+
+ public Class<WSPolicy> getModelType() {
+ return WSPolicy.class;
+ }
+
+ public void resolve(WSPolicy wsPolicy, ModelResolver modelResolver) throws ContributionResolveException {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java
new file mode 100644
index 0000000000..8ea2395d04
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java
@@ -0,0 +1,78 @@
+/*
+ * 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 echo.server;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A sample Echo server, showing how to integrate service bindings.
+ */
+public class EchoServer {
+
+ public static EchoServer server;
+
+ private Map<String, EchoServiceListener> services = new HashMap<String, EchoServiceListener>();
+
+ public static void start() {
+ }
+
+ public static void stop() {
+ }
+
+ public static EchoServer getServer() {
+ if (server == null)
+ server = new EchoServer();
+ return server;
+ }
+
+ /**
+ * Register a service under the given name.
+ *
+ * @param service
+ * @param name
+ */
+ public void register(String uri, EchoServiceListener service) {
+ if (services.isEmpty()) {
+ start();
+ }
+ services.put(uri, service);
+ }
+
+ public void unregister(String uri) {
+ services.remove(uri);
+ if (services.isEmpty()) {
+ stop();
+ }
+ }
+
+ /**
+ * Dispatch an incoming interaction to the corresponding service.
+ *
+ * @param uri
+ * @param input
+ * @return
+ */
+ public String sendReceive(String uri, String input) throws InvocationTargetException {
+ return services.get(uri).sendReceive(input);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java
new file mode 100644
index 0000000000..32336dd94f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java
@@ -0,0 +1,52 @@
+/*
+ * 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 echo.server;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+
+public class EchoServiceListener {
+ private Invoker invoker;
+ private MessageFactory messageFactory;
+
+ public EchoServiceListener(Invoker invoker, MessageFactory messageFactory) {
+ super();
+ this.invoker = invoker;
+ this.messageFactory = messageFactory;
+ }
+
+ public String sendReceive(String input) throws InvocationTargetException {
+
+ // Create a request message
+ Message request = messageFactory.createMessage();
+ request.setBody(new Object[] {input});
+
+ // Dispatch and get the response
+ Message response = invoker.invoke(request);
+ Object body = response.getBody();
+ if (response.isFault()) {
+ throw new InvocationTargetException((Throwable)body);
+ }
+ return (String)body;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory
new file mode 100644
index 0000000000..55be293862
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory
@@ -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 model factory
+echo.impl.EchoBindingFactoryImpl
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..06d53250c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://echo#binding.echo,model=echo.EchoBinding,factory=echo.EchoBindingFactory
+echo.provider.policy.EchoBindingEncryptionPolicyProcessor;qname=http://sample/policy#echoBindingPolicy,model=echo.provider.policy.EchoBindingEncryptionPolicy
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://schemas.xmlsoap.org/ws/2004/09/policy#PolicyAttachment,model=echo.provider.policy.WSPolicy
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
new file mode 100644
index 0000000000..4ad61f573d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
@@ -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.
+
+# URI of the XML schema to be used for validation
+sample-binding-echo.xsd
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
new file mode 100644
index 0000000000..efa475ef92
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/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 provider extension
+echo.provider.EchoBindingProviderFactory;model=echo.EchoBinding
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd
new file mode 100644
index 0000000000..9b64df4871
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://echo"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:e="http://echo"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0"/>
+
+ <element name="binding.echo" type="e:EchoBinding"/>
+
+ <complexType name="EchoBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/java/echo/Echo.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/java/echo/Echo.java
new file mode 100644
index 0000000000..1d5e973f33
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/java/echo/Echo.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 echo;
+
+/**
+ * Interface of our sample Echo service.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Echo {
+
+ String echo(String msg);
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java
new file mode 100644
index 0000000000..ba68dfe908
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * A simple client component that uses a reference with an Echo binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EchoComponentImpl implements Echo {
+
+ private Echo echoReference;
+
+ @Constructor
+ public EchoComponentImpl(@Reference(name = "echoReference", required = true) Echo echoReference) {
+ this.echoReference = echoReference;
+ }
+
+ public String echo(String msg) {
+ String result = echoReference.echo(msg);
+ System.out.println("Returned message: "+ result);
+ return result;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java
new file mode 100644
index 0000000000..7383077f18
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.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 echo;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EchoReferenceTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private Echo service;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("EchoBinding.composite");
+ service = scaDomain.getService(Echo.class, "EchoComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testEchoBinding() {
+ String result = service.echo("foo");
+ assertEquals(result, "oof");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java
new file mode 100644
index 0000000000..ab05516622
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.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 echo;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import echo.server.EchoServer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EchoServiceTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("EchoBinding.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testEchoBinding() throws Exception {
+ String result = EchoServer.getServer().sendReceive("http://tempuri.org", "foo");
+ assertEquals(result, "oof");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/resources/EchoBinding.composite b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/resources/EchoBinding.composite
new file mode 100644
index 0000000000..ecb6063010
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/resources/EchoBinding.composite
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/echo"
+ xmlns:se="http://sample/echo"
+ xmlns:e="http://echo"
+ xmlns:p="http://sample/policy"
+ name="EchoBinding">
+
+ <service name="EchoService" promote="EchoComponent">
+ <interface.java interface="echo.Echo"/>
+ <e:binding.echo uri="http://tempuri.org" />
+ </service>
+
+ <component name="EchoComponent">
+ <implementation.java class="echo.EchoComponentImpl"/>
+ </component>
+
+ <reference name="EchoReference" promote="EchoComponent/echoReference">
+ <interface.java interface="echo.Echo"/>
+ <e:binding.echo uri="http://tempuri.org" policySets="p:EncryptionPolicy" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/resources/definitions.xml b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/resources/definitions.xml
new file mode 100644
index 0000000000..a742804fb8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/binding-echo-extension/src/test/resources/definitions.xml
@@ -0,0 +1,198 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<sca:definitions xmlns="http://test"
+ targetNamespace="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+ <!-- qualified intents -->
+ <sca:intent name="confidentiality.transport" />
+ <sca:intent name="confidentiality.message" />
+ <sca:intent name="confidentiality.message.whole" />
+ <sca:intent name="confidentiality.message.body" />
+
+ <!-- POLICY SETS -->
+ <sca:policySet name="p:EncryptionPolicy"
+ provides="confidentiality"
+ appliesTo="sca:binding.echo"
+ xmlns="http://test"
+ xmlns:p="http://sample/policy">
+ <p:echoBindingPolicy name="Encryption" strategy="echo.provider.policy.ReverseEncryptionStrategy" />
+ </sca:policySet>
+
+ <sca:policySet name="SecureReliablePolicy"
+ provides="confidentiality.transport integrity"
+ appliesTo="sca:binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "basic authentication" -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "reliability" -->
+ </wsp:PolicyAttachment>
+ </sca:policySet>
+
+ <sca:policySet name="SecureReliablePolicy"
+ provides="confidentiality.transport integrity"
+ appliesTo="sca:binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "basic authentication" -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "reliability" -->
+ </wsp:PolicyAttachment>
+ </sca:policySet>
+
+ <sca:policySet name="SecureMessagingPolicies"
+ provides="confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sca:intentMap provides="confidentiality" default="transport">
+ <sca:qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "transport" alternative -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
+ </sca:qualifier>
+ <sca:qualifier name="message">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "message" alternative" -->
+ </wsp:PolicyAttachment>
+ </sca:qualifier>
+ </sca:intentMap>
+</sca:policySet>
+
+<sca:policySet name="SecurityPolicy" provides="confidentiality"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" >
+ <sca:intentMap provides="confidentiality" default="message">
+ <sca:qualifier name="message">
+ <sca:intentMap provides="message" default="whole">
+ <sca:qualifier name="body">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for body encryption -->
+ </wsp:PolicyAttachment>
+ </sca:qualifier>
+ <sca:qualifier name="whole">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for whole message encryption -->
+ </wsp:PolicyAttachment>
+ </sca:qualifier>
+ </sca:intentMap>
+ </sca:qualifier>
+ <sca:qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for transport encryption -->
+ </wsp:PolicyAttachment>
+ </sca:qualifier>
+ </sca:intentMap>
+</sca:policySet>
+
+<sca:policySet name="BasicAuthMsgProtSecurity"
+ provides="authentication confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://test">
+ <sca:policySetReference name="AuthenticationPolicies"/>
+ <sca:policySetReference name="ConfidentialityPolicies"/>
+</sca:policySet>
+
+<sca:policySet name="AuthenticationPolicies"
+ provides="authentication"
+ appliesTo="binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "basic
+ authentication" -->
+ </wsp:PolicyAttachment>
+</sca:policySet>
+
+<sca:policySet name="ConfidentialityPolicies"
+ provides="confidentiality"
+ bindings="binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sca:intentMap provides="confidentiality" default="transport">
+ <sca:qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "transport"
+ alternative -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
+ </sca:qualifier>
+ <sca:qualifier name="message">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "message"
+ alternative" -->...
+ </wsp:PolicyAttachment>
+ </sca:qualifier>
+ </sca:intentMap>
+</sca:policySet>
+
+<!-- profile intent -->
+ <sca:intent name="reliableMessageProtection"
+ constrains="sca:binding"
+ requires="messageProtection">
+ <sca:description>
+ Protect messages from unauthorized reading or modification
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="messageProtection"
+ constrains="sca:binding"
+ requires="confidentiality integrity">
+ <sca:description>
+ Protect messages from unauthorized reading or modification
+ </sca:description>
+ </sca:intent>
+
+<!-- simple intent -->
+ <sca:intent name="confidentiality"
+ constrains="sca:binding">
+ <sca:description>
+ Communitcation thro this binding must prevent
+ unauthorized users from reading the messages.
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="integrity"
+ constrains="sca:binding">
+ <sca:description>
+ Communitcation thro this binding must prevent
+ unauthorized modification of the messages.
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="authentication"
+ constrains="sca:binding">
+ <sca:description>
+ Communitcation thro this binding required
+ Authentication.
+ </sca:description>
+ </sca:intent>
+
+</sca:definitions> \ No newline at end of file