summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/tags/0.99-incubating/modules/binding-jms
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:26:33 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:26:33 +0000
commita40e527938d76ba71f211da7e327adb50384ba69 (patch)
treecb8f99f1727122b040a3f0fbb6649292b6a74302 /sca-java-1.x/tags/0.99-incubating/modules/binding-jms
parent968721109881107520d7aefa91d7fcc0519d7739 (diff)
Moving 1.x tags
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835157 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/tags/0.99-incubating/modules/binding-jms')
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/DISCLAIMER8
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/LICENSE205
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/NOTICE6
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/pom.xml111
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/ActivationSpec.java30
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/ConnectionFactory.java31
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/ConnectionInfo.java39
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/CorrelationScheme.java27
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/CreateResource.java32
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/Definitions.java29
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/Destination.java46
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/DestinationType.java31
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/Headers.java50
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java101
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingFactory.java47
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/OperationProperties.java36
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/Property.java35
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/PropertyList.java31
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/ResourceAdapter.java36
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java524
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java59
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingException.java40
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java414
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java169
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java179
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java54
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java129
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java118
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.java49
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorImpl.java163
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java45
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryActiveMQImpl.java139
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java52
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java26
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java27
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSTestCase.java86
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/resources/JMSBindingTest.composite110
-rw-r--r--sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/resources/wsdl/helloworld.wsdl130
40 files changed, 3482 insertions, 0 deletions
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/DISCLAIMER b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/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/tags/0.99-incubating/modules/binding-jms/LICENSE b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/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/tags/0.99-incubating/modules/binding-jms/NOTICE b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/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/tags/0.99-incubating/modules/binding-jms/pom.xml b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/pom.xml
new file mode 100644
index 0000000000..a4921dfd07
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/pom.xml
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.99-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-binding-jms</artifactId>
+ <name>Apache Tuscany JMS Binding</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>sca-api</artifactId>
+ <version>0.99-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>0.99-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>0.99-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.99-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.99-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>0.99-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>0.99-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apache-activemq</artifactId>
+ <version>4.1.1</version>
+ <!--version>4.2-SNAPSHOT</version-->
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/ActivationSpec.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/ActivationSpec.java
new file mode 100644
index 0000000000..eb441420aa
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/ActivationSpec.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface ActivationSpec extends PropertyList {
+ String getName();
+ void setName(String name);
+ CreateResource getCreate();
+ void setCreate(CreateResource create);
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/ConnectionFactory.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/ConnectionFactory.java
new file mode 100644
index 0000000000..d0f7a473ac
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/ConnectionFactory.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ConnectionFactory extends PropertyList {
+ String getName();
+ void setName(String name);
+ CreateResource getCreate();
+ void setCreate(CreateResource create);
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/ConnectionInfo.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/ConnectionInfo.java
new file mode 100644
index 0000000000..b792c1c333
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/ConnectionInfo.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms;
+
+/**
+ * Specifies the metadata for a JMS connection
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ConnectionInfo {
+ Destination getDestination();
+
+ ConnectionFactory getConnectionFactory();
+
+ ActivationSpec getActivationSpec();
+
+ void setDestination(Destination destination);
+
+ void setConnectionFactory(ConnectionFactory connectionFactory);
+
+ void setActivationSpec(ActivationSpec activationSpec);
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/CorrelationScheme.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/CorrelationScheme.java
new file mode 100644
index 0000000000..5fa8a3c371
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/CorrelationScheme.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public enum CorrelationScheme {
+ RequestMsgIDToCorrelID, RequestCorrelIDToCorrelID, None
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/CreateResource.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/CreateResource.java
new file mode 100644
index 0000000000..cba2f37e80
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/CreateResource.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms;
+
+/**
+ * Indicates whether the destination should be created when the containing composite is
+ * deployed. Valid values are "always", "never" and "ifnotexist". The default value is
+ * "ifnotexist". If "always" is specified and the corresponding resource already exists,
+ * then this should be considered an error
+ *
+ * @version $Rev$ $Date$
+ */
+public enum CreateResource {
+ ALWAYS, NEVER, IFNOTEXIST
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/Definitions.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/Definitions.java
new file mode 100644
index 0000000000..f81192d6d9
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/Definitions.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms;
+
+import java.util.List;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface Definitions {
+ List<JMSBinding> getBindings();
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/Destination.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/Destination.java
new file mode 100644
index 0000000000..47cb3633ef
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/Destination.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms;
+
+/**
+ * Identifies the destination that is to be used to process requests/responses by this
+ * binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Destination extends PropertyList {
+ /**
+ * The name of the destination to which the binding is connected. This may be a JNDI
+ * name or a plain destination name
+ *
+ * @return
+ */
+ String getName();
+
+ void setName(String name);
+
+ DestinationType getType();
+
+ void setType(DestinationType type);
+
+ CreateResource getCreate();
+
+ void setCreate(CreateResource create);
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/DestinationType.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/DestinationType.java
new file mode 100644
index 0000000000..d8d5983d0f
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/DestinationType.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms;
+
+/**
+ * The type of the request destination. Must take one of the values "queue" or "topic".
+ * The default value is "queue". When "topic" is specified, then all the operations in
+ * the interface that corresponds to the binding must be one-way.
+ *
+ * @version $Rev$ $Date$
+ */
+public enum DestinationType {
+ QUEUE, TOPIC
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/Headers.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/Headers.java
new file mode 100644
index 0000000000..d3bc110087
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/Headers.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms;
+
+/**
+ * this element allows JMS headers to be set to the given values for all
+ * operations. These values apply to requests from a reference and responses
+ * from a service.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Headers extends PropertyList {
+ String getJMSType();
+
+ void setJMSType(String jmsType);
+
+ String getJMSCorrelationId();
+
+ void setJMSCorrelationId(String jmsCorrelationId);
+
+ String getJMSDeliveryMode();
+
+ void setJMSDeliveryMode(String jmsDeliveryMode);
+
+ String getJMSTimeToLive();
+
+ void setJMSTimeToLive(String jmsTimeToLive);
+
+ String getJMSPriority();
+
+ void setJMSPriority(String jmsPriority);
+
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java
new file mode 100644
index 0000000000..84c638c845
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms;
+
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Extensible;
+
+/**
+ * This is the generic JMS binding type. The type is extensible so that JMS
+ * binding implementers can add additional JMS provider-specific attributes and
+ * elements although such extensions are not guaranteed to be portable across
+ * runtimes.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JMSBinding extends Binding, Extensible {
+ /**
+ * Identifies the correlation scheme used when sending reply or callback
+ * messages. Valid values are "RequestMsgIDToCorrelID" (the default),
+ * "RequestCorrelIDToCorrelID", and "None".
+ *
+ * @return
+ */
+ CorrelationScheme getCorrelationScheme();
+
+ void setCorrelationScheme(CorrelationScheme correlationScheme);
+
+ /**
+ * the name of the JNDI initial context factory
+ *
+ * @return
+ */
+ String getInitialContextFactory();
+
+ void setInitialContextFactory(String initialContextFactory);
+
+ /**
+ * The URL for the JNDI provider
+ *
+ * @return
+ */
+ String getJndiURL();
+
+ void setJndiURL(String jndiURL);
+
+ /**
+ * identifies a binding.jms element that is present in a definition
+ * document, whose destination, connectionFactory, activationSpec and
+ * resourceAdapter children are used to define the values for this binding.
+ * In this case the corresponding elements must not be present within this
+ * binding element
+ *
+ * @return
+ */
+ ConnectionInfo getRequestConnection();
+
+ void setRequestConnection(ConnectionInfo requestConnection);
+
+ /**
+ * identifies a binding.jms element that is present in a definition
+ * document, whose response child element is used to define the values for
+ * this binding. In this case no response element must be present within
+ * this binding element
+ *
+ * @return
+ */
+ ConnectionInfo getResponseConnection();
+
+ void setResponseConnection(ConnectionInfo responseConnection);
+
+ /**
+ * identifies a binding.jms element that is present in a definition
+ * document, whose operationProperties children are used to define the
+ * values for this binding. In this case no operationProperties elements
+ * must be present within this binding element
+ *
+ * @return
+ */
+ OperationProperties getOperationProperties();
+
+ void setOperationProperties(OperationProperties operationProperties);
+
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingFactory.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingFactory.java
new file mode 100644
index 0000000000..2394cf5cdc
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingFactory.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms;
+
+/**
+ * The factory to create the JMS binding model objects
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JMSBindingFactory {
+ JMSBinding createJMSBinding();
+
+ ActivationSpec createActivationSpec();
+
+ ConnectionFactory createConnectionFactory();
+
+ ConnectionInfo createConnectionInfo();
+
+ Definitions createDefinitions();
+
+ Destination createDestination();
+
+ Headers createHeaders();
+
+ OperationProperties createOperationProperties();
+
+ Property createProperty();
+
+ ResourceAdapter createResourceAdapter();
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/OperationProperties.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/OperationProperties.java
new file mode 100644
index 0000000000..b67a6a414a
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/OperationProperties.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms;
+
+/**
+ * Specifies various properties that are specific to the processing of a particular
+ * operation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface OperationProperties extends PropertyList {
+ Headers getHeaders();
+
+ void setHeaders(Headers headers);
+
+ String getNativeOperation();
+
+ void setNativeOperation(String nativeOperation);
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/Property.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/Property.java
new file mode 100644
index 0000000000..efe45d4683
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/Property.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms;
+
+/**
+ * Specifies the value to use for the specified JMS user property
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Property {
+ String getName();
+
+ void setName(String name);
+
+ String getValue();
+
+ void setValue(String type);
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/PropertyList.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/PropertyList.java
new file mode 100644
index 0000000000..323df239d4
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/PropertyList.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms;
+
+import java.util.List;
+
+/**
+ * A list of properties
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PropertyList {
+ List<Property> getProperties();
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/ResourceAdapter.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/ResourceAdapter.java
new file mode 100644
index 0000000000..633614198e
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/ResourceAdapter.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms;
+
+/**
+ * Specifies name, type and properties of the Resource Adapter Java bean. This is required
+ * when the JMS resources are to be created for a JCA 1.5-compliant JMS provider, and is
+ * ignored otherwise. There may be a restriction, depending on the deployment platform,
+ * about specifying properties of the RA Java Bean. For non-JCA 1.5-compliant JMS providers,
+ * information necessary for resource creation must be done in provider-specific elements or
+ * attributes allowed by the extensibility of the binding.jms element.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ResourceAdapter extends PropertyList {
+ String getName();
+
+ void setName(String name);
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java
new file mode 100644
index 0000000000..b3fc1d92e2
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java
@@ -0,0 +1,524 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.binding.jms.impl;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jms.DeliveryMode;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
+import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
+
+
+/**
+ * Models a binding to a JMS resource.
+ */
+
+public class JMSBinding implements Binding {
+
+ // properties required to implement the Tuscany
+ // binding extension SPI
+ private String uri = null;
+ private String name = null;
+ private boolean unresolved = false;
+ private List<Object> extensions = new ArrayList<Object>();
+
+ // Properties required to describe the JMS
+ // binding model
+
+ // <binding.jms correlationScheme="string"? Not yet implemented in binding
+ // initialContextFactory="xs:anyURI"?
+ // jndiURL="xs:anyURI"?
+ // requestConnection="QName"? Not yet implemented in binding
+ // responseConnection="QName"? Not yet implemented in binding
+ // operationProperties="QName"? Not yet implemented in binding
+ // ...>
+ private String correlationScheme = JMSBindingConstants.CORRELATE_MSG_ID;
+ private String initialContextFactoryName = JMSBindingConstants.DEFAULT_CONTEXT_FACTORY_NAME;
+ private String jndiURL = JMSBindingConstants.DEFAULT_JNDI_URL;
+ //private String requestConnection = null;
+ //private String responseConnection = null;
+ //private String operationProperties = null;
+ //
+ // <destination name="xs:anyURI"
+ // type="string"? Not yet implemented in binding
+ // create="string"?> Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // </destination>?
+ private String destinationName = JMSBindingConstants.DEFAULT_DESTINATION_NAME;
+ private String destinationType = JMSBindingConstants.DESTINATION_TYPE_QUEUE;
+ private String destinationCreate = JMSBindingConstants.CREATE_NEVER;
+ //
+ // <connectionFactory name="xs:anyURI" Not yet implemented in binding
+ // create="string"?> Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // </connectionFactory>?
+ private String connectionFactoryName = JMSBindingConstants.DEFAULT_CONNECTION_FACTORY_NAME;
+ private String connectionFactoryCreate = JMSBindingConstants.CREATE_NEVER;
+ //
+ // <activationSpec name="xs:anyURI" Not yet implemented in binding
+ // create="string"?> Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // </activationSpec>?
+ private String activationSpecName = null;
+ private String activationSpecCreate = null;
+ //
+ // <response>
+ // <destination name="xs:anyURI"
+ // type="string"? Not yet implemented in binding
+ // create="string"?> Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // </destination>?
+ private String responseDestinationName = JMSBindingConstants.DEFAULT_RESPONSE_DESTINATION_NAME;
+ private String responseDestinationType = JMSBindingConstants.DESTINATION_TYPE_QUEUE;
+ private String responseDestinationCreate = JMSBindingConstants.CREATE_NEVER;
+ //
+ // <connectionFactory name="xs:anyURI" Not yet implemented in binding
+ // create="string"?> Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // </connectionFactory>?
+ private String responseConnectionFactoryName = JMSBindingConstants.DEFAULT_CONNECTION_FACTORY_NAME;
+ private String responseConnectionFactoryCreate = JMSBindingConstants.CREATE_NEVER;
+ //
+ // <activationSpec name="xs:anyURI" Not yet implemented in binding
+ // create="string"?> Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // </activationSpec>?
+ private String responseActivationSpecName = null;
+ private String responseActivationSpecCreate = null;
+ // </response>?
+ //
+ // <resourceAdapter name="NMTOKEN">? Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // </resourceAdapter>?
+ //private String resourceAdapterName = null;
+ //
+ // <headers JMSType="string"? Not yet implemented in binding
+ // JMSCorrelationId="string"? Not yet implemented in binding
+ // JMSDeliveryMode="string"? Not yet implemented in binding
+ // JMSTimeToLive="int"? Not yet implemented in binding
+ // JMSPriority="string"?> Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // </headers>?
+ //private String jmsType = null;
+ //private String jmsCorrelationId = null;
+ private int jmsDeliveryMode = DeliveryMode.NON_PERSISTENT; // Maps to javax.jms.DeliveryMode
+ private int jmsTimeToLive = JMSBindingConstants.DEFAULT_TIME_TO_LIVE;
+ private int jmsPriority = JMSBindingConstants.DEFAULT_PRIORITY;
+ //
+ // <operationProperties name="string" Not yet implemented in binding
+ // nativeOperation="string"?> Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // <headers JMSType="string"? Not yet implemented in binding
+ // JMSCorrelationId="string"? Not yet implemented in binding
+ // JMSDeliveryMode="string"? Not yet implemented in binding
+ // JMSTimeToLive="int"? Not yet implemented in binding
+ // JMSPriority="string"?> Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // </headers>?
+ // </operationProperties>*
+ // </binding.jms>
+
+ // Other properties not directly related to the
+ // XML definition of the JMS binding
+
+
+ // Provides the name of the factory that interfaces to the
+ // JMS API for us.
+ private String jmsResourceFactoryName = JMSBindingConstants.DEFAULT_RF_CLASSNAME;
+
+ // Message processors used to deal with the request
+ // and response messages
+ public String requestMessageProcessorName = JMSBindingConstants.DEFAULT_MP_CLASSNAME;
+ public String responseMessageProcessorName = JMSBindingConstants.DEFAULT_MP_CLASSNAME;
+
+ // The JMS message property used to hold the name of the
+ // operation being called
+ private String operationSelectorPropertyName = JMSBindingConstants.DEFAULT_OPERATION_PROP_NAME;
+
+ // If the operation selector is derived automatically from the service
+ // interface it's stored here
+ private String operationSelectorName = null;
+
+ // Set true if messages are sent/received in XML format
+ private boolean xmlFormat = false;
+
+
+//TODO .....
+ private String replyTo;
+
+
+ // Methods required by the Tuscany SPI
+
+ /**
+ * No arg constructor used by the JSMBindingFactoryImpl
+ * to create JMS binding model objects
+ *
+ */
+ public JMSBinding() {
+ super();
+ }
+
+ /**
+ * Returns the binding URI.
+ *
+ * @return the binding uri
+ */
+ public String getURI() {
+ return this.uri;
+ }
+
+ /**
+ * Sets the binding URI.
+ *
+ * @param uri the binding uri
+ */
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ /**
+ * Returns the binding name.
+ *
+ * @return the binding name
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Sets the binding name.
+ *
+ * @param name the binding name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+ public boolean isUnresolved() {
+ return this.unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ // Methods for getting/setting JMS binding model information
+ // as derived from the XML of the binding.jms element
+
+ public void setCorrelationScheme(String correlationScheme) {
+ this.correlationScheme = correlationScheme;
+ }
+ public String getCorrelationScheme() {
+ return correlationScheme;
+ }
+
+ public String getInitialContextFactoryName() {
+ return initialContextFactoryName;
+ }
+ public void setInitialContextFactoryName(String initialContextFactoryName) {
+ this.initialContextFactoryName = initialContextFactoryName;
+ }
+
+ public String getJndiURL() {
+ return this.jndiURL;
+ }
+ public void setJndiURL(String jndiURL) {
+ this.jndiURL = jndiURL;
+ }
+
+ public String getDestinationName() {
+ return destinationName;
+ }
+ public void setDestinationName(String destinationName) {
+ this.destinationName = destinationName;
+ }
+
+ public String getDestinationType() {
+ return destinationType;
+ }
+ public void setDestinationType(String destinationType) {
+ this.destinationType = destinationType;
+ }
+
+ public String getDestinationCreate() {
+ return this.destinationCreate;
+ }
+ public void setDestinationCreate(String create) {
+ this.destinationCreate = create;
+ }
+
+ public String getConnectionFactoryName() {
+ return connectionFactoryName;
+ }
+ public void setConnectionFactoryName(String connectionFactoryName) {
+ this.connectionFactoryName = connectionFactoryName;
+ }
+
+ public String getConnectionFactoryCreate() {
+ return this.connectionFactoryCreate;
+ }
+ public void setConnectionFactoryCreate(String create) {
+ this.connectionFactoryCreate = create;
+ }
+
+ public String getActivationSpecName() {
+ return activationSpecName;
+ }
+ public void setActivationSpecName(String activationSpecName) {
+ this.activationSpecName = activationSpecName;
+ }
+
+ public String getActivationSpecCreate() {
+ return this.activationSpecCreate;
+ }
+ public void setActivationSpecCreate(String create) {
+ this.activationSpecCreate = create;
+ }
+
+ public String getResponseDestinationName() {
+ return this.responseDestinationName;
+ }
+ public void setResponseDestinationName(String name) {
+ this.responseDestinationName = name;
+ }
+
+ public String getResponseDestinationType() {
+ return this.responseDestinationType;
+ }
+ public void setResponseDestinationType(String type) {
+ this.responseDestinationType = type;
+ }
+
+ public String getResponseDestinationCreate() {
+ return this.responseDestinationCreate;
+ }
+ public void setResponseDestinationCreate(String create) {
+ this.responseDestinationCreate = create;
+ }
+
+ public String getResponseConnectionFactoryName() {
+ return responseConnectionFactoryName;
+ }
+ public void setResponseConnectionFactoryName(String connectionFactoryName) {
+ this.responseConnectionFactoryName = connectionFactoryName;
+ }
+
+ public String getResponseConnectionFactoryCreate() {
+ return this.responseConnectionFactoryCreate;
+ }
+ public void setResponseConnectionFactoryCreate(String create) {
+ this.responseConnectionFactoryCreate = create;
+ }
+
+ public String getResponseActivationSpecName() {
+ return responseActivationSpecName;
+ }
+ public void setResponseActivationSpecName(String activationSpecName) {
+ this.responseActivationSpecName = activationSpecName;
+ }
+
+ public String getResponseActivationSpecCreate() {
+ return this.responseActivationSpecCreate;
+ }
+ public void setResponseActivationSpecCreate(String create) {
+ this.responseActivationSpecCreate = create;
+ }
+
+ public int getDeliveryMode() {
+ return jmsDeliveryMode;
+ }
+ public void setDeliveryMode(int deliveryMode) {
+ this.jmsDeliveryMode = deliveryMode;
+ }
+
+ public int getTimeToLive() {
+ return jmsTimeToLive;
+ }
+ public void setTimeToLive(int timeToLive) {
+ this.jmsTimeToLive = timeToLive;
+ }
+
+ public int getPriority() {
+ return jmsPriority;
+ }
+ public void setPriority(int priority) {
+ this.jmsPriority = priority;
+ }
+
+ // operations to manage the other information required by the
+ // JMS binding
+
+ public String getJmsResourceFactoryName() {
+ return jmsResourceFactoryName;
+ }
+ public void setJmsResourceFactoryName(String jmsResourceFactoryName) {
+ this.jmsResourceFactoryName = jmsResourceFactoryName;
+ }
+ public JMSResourceFactory getJmsResourceFactory() {
+ return (JMSResourceFactory)instantiate(null,jmsResourceFactoryName);
+ }
+
+ public void setRequestMessageProcessorName(String name) {
+ this.requestMessageProcessorName = name;
+ }
+ public String getRequestMessageProcessorName() {
+ return requestMessageProcessorName;
+ }
+ public JMSMessageProcessor getRequestMessageProcessor() {
+ return (JMSMessageProcessor)instantiate(null,requestMessageProcessorName);
+ }
+
+ public void setResponseMessageProcessorName(String name) {
+ this.responseMessageProcessorName = name;
+ }
+ public String getResponseMessageProcessorName() {
+ return responseMessageProcessorName;
+ }
+ public JMSMessageProcessor getResponseMessageProcessor() {
+ return (JMSMessageProcessor)instantiate(null,responseMessageProcessorName);
+ }
+
+ public String getOperationSelectorPropertyName() {
+ return operationSelectorPropertyName;
+ }
+ public void setOperationSelectorPropertyName(String operationSelectorPropertyName) {
+ this.operationSelectorPropertyName = operationSelectorPropertyName;
+ }
+
+ public String getOperationSelectorName() {
+ return operationSelectorName;
+ }
+ public void setOperationSelectorName(String operationSelectorName) {
+ this.operationSelectorName = operationSelectorName;
+ }
+
+ public boolean getXMLFormat() {
+ return xmlFormat;
+ }
+ public void setXMLFormat(boolean b) {
+ this.xmlFormat = b;
+ }
+
+ /**
+ * Used to create instances of the JMSResourceFactory
+ * and RequestMessageProcessor and ResponseMessageProcessor
+ * from sting based classname provided in the configuration
+ *
+ * @param cl classloader
+ * @param className the string based classname to load and instantiate
+ * @return the new object
+ */
+ private Object instantiate(ClassLoader cl, String className) {
+ Object instance;
+ if (cl == null) {
+ cl = this.getClass().getClassLoader();
+ }
+
+ try {
+ Class clazz;
+
+ try {
+ clazz = cl.loadClass(className);
+ } catch (ClassNotFoundException e) {
+ clazz = this.getClass().getClassLoader().loadClass(className);
+ }
+
+ Constructor constructor = clazz.getDeclaredConstructor(new Class[]{JMSBinding.class});
+ instance = constructor.newInstance(this);
+
+ } catch (Throwable e) {
+ throw new JMSBindingException("Exception instantiating OperationAndDataBinding class", e);
+ }
+
+ return instance;
+ }
+
+ /**
+ * The validation rules for the JMS model are relatively complicated to
+ * they all live together here
+ */
+ public void validate() throws JMSBindingException {
+ /*
+ * first fix up anything now the model
+ * has been read
+ */
+
+ if (getDestinationName().equals(JMSBindingConstants.DEFAULT_DESTINATION_NAME)){
+ /*
+ * No desitnation name has been set so make sure that
+ * the runtime is able to create one automatically
+ */
+ setDestinationCreate(JMSBindingConstants.CREATE_ALLWAYS);
+ }
+
+ if (getResponseDestinationName().equals(JMSBindingConstants.DEFAULT_RESPONSE_DESTINATION_NAME)){
+ /*
+ * No repsonse desitination name has been set so make sure that
+ * the runtime is able to create one automatically
+ */
+ setResponseDestinationCreate(JMSBindingConstants.CREATE_ALLWAYS);
+ }
+
+
+ /*
+ * Now some cross field validation
+ */
+
+ // connection factory doesn't contradict detsination type
+
+ // connection factory and activation spec are mutually exclusive
+
+ // TODO check spec for all validations
+ }
+
+
+// TODO...
+
+
+ public String getReplyTo() {
+ return replyTo;
+ }
+
+ public void setReplyTo(String replyTo) {
+ this.replyTo = replyTo;
+ }
+
+
+
+
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java
new file mode 100644
index 0000000000..425fa6194e
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.binding.jms.impl;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorImpl;
+import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryActiveMQImpl;
+
+public interface JMSBindingConstants {
+
+ // Contants used when describing the JMS binding
+ // model and for setting up defaults
+ public final static String BINDING_JMS = "binding.jms";
+ public final static QName BINDING_JMS_QNAME = new QName(Constants.SCA10_NS, BINDING_JMS);
+ public final static String CORRELATE_MSG_ID = "requestmsgidtocorrelid";
+ public final static String CORRELATE_CORRELATION_ID = "requestcorrelidtocorrelid";
+ public final static String CORRELATE_NONE = "none";
+ public final static List<String> VALID_CORRELATION_SCHEMES = Arrays.asList(new String[] {CORRELATE_MSG_ID,
+ CORRELATE_CORRELATION_ID,
+ CORRELATE_NONE});
+ public final static String DESTINATION_TYPE_QUEUE = "queue"; //0
+ public final static String DESTINATION_TYPE_TOPIC = "topic"; //1
+ public final static List<String> VALID_DESTINATION_TYPES = Arrays.asList(new String[] {DESTINATION_TYPE_QUEUE,
+ DESTINATION_TYPE_TOPIC});
+ public final static String CREATE_ALLWAYS = "always";
+ public final static String CREATE_NEVER = "never";
+ public final static String DEFAULT_DESTINATION_NAME = "NODESTINATION";
+ public final static String DEFAULT_RESPONSE_DESTINATION_NAME = "NORESPONSEDESTINATION";
+ public final static String DEFAULT_CONNECTION_FACTORY_NAME = "ConnectionFactory";
+ public final static String DEFAULT_CONTEXT_FACTORY_NAME = "org.apache.activemq.jndi.ActiveMQInitialContextFactory";
+ public final static String DEFAULT_JNDI_URL = "tcp://localhost:61616";
+ public final static int DEFAULT_TIME_TO_LIVE = 10000; // in milli seconds
+ public final static int DEFAULT_PRIORITY = 1;
+ public final static String DEFAULT_RF_CLASSNAME = JMSResourceFactoryActiveMQImpl.class.getName();
+ public final static String DEFAULT_MP_CLASSNAME = JMSMessageProcessorImpl.class.getName();
+ public final static String DEFAULT_OPERATION_PROP_NAME = "scaOperationName";
+
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingException.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingException.java
new file mode 100644
index 0000000000..60cd33d9bb
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingException.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.binding.jms.impl;
+
+public class JMSBindingException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
+ public JMSBindingException() {
+ super();
+ }
+
+ public JMSBindingException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+ public JMSBindingException(String arg0) {
+ super(arg0);
+ }
+
+ public JMSBindingException(Throwable arg0) {
+ super(arg0);
+ }
+
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
new file mode 100644
index 0000000000..ac0a73c31d
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
@@ -0,0 +1,414 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms.impl;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.List;
+import java.util.StringTokenizer;
+
+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.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * A processor to read the XML that describes the JMS binding...
+ *
+ * <binding.jms correlationScheme="string"?
+ * initialContextFactory="xs:anyURI"?
+ * jndiURL="xs:anyURI"?
+ * requestConnection="QName"?
+ * responseConnection="QName"?
+ * operationProperties="QName"?
+ * ...>
+ *
+ * <destination name="xs:anyURI" type="string"? create="string"?>
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * </destination>?
+ *
+ * <connectionFactory name="xs:anyURI" create="string"?>
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * </connectionFactory>?
+ *
+ * <activationSpec name="xs:anyURI" create="string"?>
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * </activationSpec>?
+ *
+ * <response>
+ * <destination name="xs:anyURI" type="string"? create="string"?>
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * </destination>?
+ *
+ * <connectionFactory name="xs:anyURI" create="string"?>
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * </connectionFactory>?
+ *
+ * <activationSpec name="xs:anyURI" create="string"?>
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * </activationSpec>?
+ * </response>?
+ *
+ * <resourceAdapter name="NMTOKEN">?
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * </resourceAdapter>?
+ *
+ * <headers JMSType="string"?
+ * JMSCorrelationId="string"?
+ * JMSDeliveryMode="string"?
+ * JMSTimeToLive="int"?
+ * JMSPriority="string"?>
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * </headers>?
+ *
+ * <operationProperties name="string" nativeOperation="string"?>
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * <headers JMSType="string"?
+ * JMSCorrelationId="string"?
+ * JMSDeliveryMode="string"?
+ * JMSTimeToLive="int"?
+ * JMSPriority="string"?>
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * </headers>?
+ * </operationProperties>*
+ * </binding.jms>
+ */
+
+public class JMSBindingProcessor implements StAXArtifactProcessor<JMSBinding>{
+
+ private PolicyFactory policyFactory;
+
+
+ public JMSBindingProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ }
+
+ public QName getArtifactType() {
+ return JMSBindingConstants.BINDING_JMS_QNAME;
+ }
+
+ public Class<JMSBinding> getModelType() {
+ return JMSBinding.class;
+ }
+
+ public JMSBinding read(XMLStreamReader reader)
+ throws ContributionReadException {
+ try {
+ JMSBinding jmsBinding = new JMSBinding();
+
+ // Read policies
+ if ( jmsBinding instanceof PolicySetAttachPoint ) {
+ readPolicies((PolicySetAttachPoint)jmsBinding, reader);
+ }
+
+ // Read binding name
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null) {
+ jmsBinding.setName(name);
+ }
+
+ // Read binding URI
+ String uri = reader.getAttributeValue(null, "uri");
+ if (uri != null) {
+ jmsBinding.setURI(uri);
+ System.err.println("JMS Binding doesn't process uri yet");
+ }
+
+ // Read correlation scheme
+ String correlationScheme = reader.getAttributeValue(null, "correlationScheme");
+ if (correlationScheme != null && correlationScheme.length() > 0) {
+ if (JMSBindingConstants.VALID_CORRELATION_SCHEMES.contains(correlationScheme.toLowerCase())) {
+ jmsBinding.setCorrelationScheme(correlationScheme);
+ } else {
+ throw new JMSBindingException("invalid correlationScheme: " + correlationScheme);
+ }
+ System.err.println("JMS Binding doesn't process correlationScheme yet");
+ }
+
+ // Read initial context factory
+ String initialContextFactory = reader.getAttributeValue(null, "initialContextFactory");
+ if (initialContextFactory != null && initialContextFactory.length() > 0) {
+ jmsBinding.setInitialContextFactoryName(initialContextFactory);
+ }
+
+ // Read jndi URL
+ String jndiURL = reader.getAttributeValue(null, "jndiURL");
+ if (jndiURL != null && jndiURL.length() > 0) {
+ jmsBinding.setJndiURL(jndiURL);
+ }
+
+ // Read requestConnection
+ // TODO
+ // Read reponseConnection
+ // TODO
+ // Read operationProperties
+ // TODO
+
+ // Read subelements of binding.jms
+ boolean endFound = false;
+ while (!endFound) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ String elementName = reader.getName().getLocalPart();
+ if ("destination".equals(elementName)) {
+ parseDestination(reader, jmsBinding);
+ } else if ("connectionFactory".equals(elementName)) {
+ parseConnectionFactory(reader, jmsBinding);
+ } else if ("activationSpec".equals(elementName)) {
+ parseActivationSpec(reader, jmsBinding);
+ } else if ("response".equals(elementName)) {
+ parseResponse(reader, jmsBinding);
+ } else if ("resourceAdapter".equals(elementName)) {
+ parseResourceAdapter(reader, jmsBinding);
+ } else if ("headers".equals(elementName)) {
+ parseHeaders(reader, jmsBinding);
+ } else if ("operationProperties".equals(elementName)) {
+ parseOperationProperties(reader, jmsBinding);
+ }
+ reader.next();
+ break;
+ case END_ELEMENT:
+ QName x = reader.getName();
+ if (x.equals(JMSBindingConstants.BINDING_JMS_QNAME)) {
+ endFound = true;
+ } else {
+ throw new RuntimeException("Incomplete binding.jms definition found unexpected element " + x.toString());
+ }
+ }
+ }
+
+ jmsBinding.validate();
+
+ return jmsBinding;
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public void resolve(JMSBinding model, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+ public void write(JMSBinding rmiBinding, XMLStreamWriter writer) throws ContributionWriteException {
+ try {
+ // Write a <binding.ws>
+ writer.writeStartElement(Constants.SCA10_NS, JMSBindingConstants.BINDING_JMS);
+
+ // TODO
+
+ writer.writeEndElement();
+
+ } catch (XMLStreamException e) {
+ throw new ContributionWriteException(e);
+ }
+ }
+
+
+ /**
+ * Reads policy intents and policy sets.
+ * @param attachPoint where the intents and policy sets will be stored
+ * @param reader the XML stream reader
+ */
+ private void readPolicies(PolicySetAttachPoint attachPoint, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, Constants.REQUIRES);
+ if (value != null) {
+ List<Intent> requiredIntents = attachPoint.getRequiredIntents();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ Intent intent = policyFactory.createIntent();
+ intent.setName(qname);
+ requiredIntents.add(intent);
+ }
+ System.err.println("JMS Binding doesn't process requires yet");
+ }
+
+ value = reader.getAttributeValue(null, Constants.POLICY_SETS);
+ if (value != null) {
+ List<PolicySet> policySets = attachPoint.getPolicySets();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ PolicySet policySet = policyFactory.createPolicySet();
+ policySet.setName(qname);
+ policySets.add(policySet);
+ }
+ System.err.println("JMS Binding doesn't process policySets yet");
+ }
+ }
+
+ /**
+ * Returns a qname from a string.
+ * @param reader the XML stream reader
+ * @param value the string version of the QName
+ * @return
+ */
+ private QName getQNameValue(XMLStreamReader reader, String value) {
+ if (value != null) {
+ int index = value.indexOf(':');
+ String prefix = index == -1 ? "" : value.substring(0, index);
+ String localName = index == -1 ? value : value.substring(index + 1);
+ String ns = reader.getNamespaceContext().getNamespaceURI(prefix);
+ if (ns == null) {
+ ns = "";
+ }
+ return new QName(ns, localName, prefix);
+ } else {
+ return null;
+ }
+ }
+
+ protected void parseDestination(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null && name.length() > 0) {
+ jmsBinding.setDestinationName(name);
+ }
+
+ String type = reader.getAttributeValue(null, "type");
+ if (type != null && type.length() > 0) {
+ if (JMSBindingConstants.DESTINATION_TYPE_QUEUE.equalsIgnoreCase(type)) {
+ jmsBinding.setDestinationType(JMSBindingConstants.DESTINATION_TYPE_QUEUE);
+ } else if (JMSBindingConstants.DESTINATION_TYPE_TOPIC.equalsIgnoreCase(type)) {
+ jmsBinding.setDestinationType(JMSBindingConstants.DESTINATION_TYPE_TOPIC);
+ } else {
+ throw new RuntimeException("invalid destination type: " + type);
+ }
+ System.err.println("JMS Binding doesn't process destination type yet");
+ }
+
+ String create = reader.getAttributeValue(null, "create");
+ if (create != null && create.length() > 0) {
+ jmsBinding.setDestinationCreate(create);
+ }
+ }
+
+ protected void parseConnectionFactory(XMLStreamReader reader, JMSBinding jmsBinding) {
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null && name.length() > 0) {
+ jmsBinding.setConnectionFactoryName(name);
+ } else {
+ throw new RuntimeException("missing connectionFactory name");
+ }
+ }
+
+ protected void parseActivationSpec(XMLStreamReader reader, JMSBinding jmsBinding) {
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null && name.length() > 0) {
+ jmsBinding.setActivationSpecName(name);
+ System.err.println("JMS Binding doesn't process activationSpec yet");
+ } else {
+ throw new RuntimeException("missing ActivationSpec name");
+ }
+ }
+
+ protected void parseResponseDestination(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null && name.length() > 0) {
+ jmsBinding.setResponseDestinationName(name);
+ }
+
+ String type = reader.getAttributeValue(null, "type");
+ if (type != null && type.length() > 0) {
+ if (JMSBindingConstants.DESTINATION_TYPE_QUEUE.equalsIgnoreCase(type)) {
+ jmsBinding.setResponseDestinationType(JMSBindingConstants.DESTINATION_TYPE_QUEUE);
+ } else if (JMSBindingConstants.DESTINATION_TYPE_TOPIC.equalsIgnoreCase(type)) {
+ jmsBinding.setResponseDestinationType(JMSBindingConstants.DESTINATION_TYPE_TOPIC);
+ } else {
+ throw new RuntimeException("invalid response destination type: " + type);
+ }
+ System.err.println("JMS Binding doesn't process response destination type yet");
+ }
+
+ String create = reader.getAttributeValue(null, "create");
+ if (create != null && create.length() > 0) {
+ jmsBinding.setResponseDestinationCreate(create);
+ }
+ }
+
+ protected void parseResponseConnectionFactory(XMLStreamReader reader, JMSBinding jmsBinding) {
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null && name.length() > 0) {
+ jmsBinding.setResponseConnectionFactoryName(name);
+ System.err.println("JMS Binding doesn't process response connectionFactory yet");
+ } else {
+ throw new RuntimeException("missing response connectionFactory name");
+ }
+ }
+
+ protected void parseResponseActivationSpec(XMLStreamReader reader, JMSBinding jmsBinding) {
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null && name.length() > 0) {
+ jmsBinding.setResponseActivationSpecName(name);
+ System.err.println("JMS Binding doesn't process response activationSpec yet");
+ } else {
+ throw new RuntimeException("missing response ActivationSpec name");
+ }
+ }
+
+ protected void parseResponse(XMLStreamReader reader, JMSBinding jmsBinding)
+ throws XMLStreamException {
+ // Read subelements of response
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ String elementName = reader.getName().getLocalPart();
+ if ("destination".equals(elementName)) {
+ parseResponseDestination(reader, jmsBinding);
+ } else if ("connectionFactory".equals(elementName)) {
+ parseResponseConnectionFactory(reader, jmsBinding);
+ } else if ("activationSpec".equals(elementName)) {
+ parseResponseActivationSpec(reader, jmsBinding);
+ }
+ reader.next();
+ break;
+ case END_ELEMENT:
+ QName x = reader.getName();
+ if (x.getLocalPart().equals("response")) {
+ return;
+ } else {
+ throw new RuntimeException("Incomplete binding.jms/response definition found unexpected element " + x.toString());
+ }
+ }
+ }
+ }
+
+ protected void parseResourceAdapter(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
+ System.err.println("JMS Binding doesn't process resourceAdapter yet");
+ }
+
+ protected void parseHeaders(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
+ System.err.println("JMS Binding doesn't process headers yet");
+ }
+
+ protected void parseOperationProperties(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
+ System.err.println("JMS Binding doesn't process operationProperties yet");
+ }
+
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
new file mode 100644
index 0000000000..c6e3b799f4
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.binding.jms.provider;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.naming.NamingException;
+
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+
+/**
+ * Interceptor for the JMS binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JMSBindingInvoker implements Invoker {
+
+ protected Operation operation;
+ protected String operationName;
+
+ protected JMSBinding jmsBinding;
+ protected JMSResourceFactory jmsResourceFactory;
+ protected JMSMessageProcessor requestMessageProcessor;
+ protected JMSMessageProcessor responseMessageProcessor;
+ protected Destination requestDest;
+ protected Destination replyDest;
+
+ public JMSBindingInvoker(JMSBinding jmsBinding,
+ Operation operation ) {
+
+ this.operation = operation;
+ operationName = operation.getName();
+
+ this.jmsBinding = jmsBinding;
+ jmsResourceFactory = jmsBinding.getJmsResourceFactory();
+ requestMessageProcessor = jmsBinding.getRequestMessageProcessor();
+ responseMessageProcessor = jmsBinding.getResponseMessageProcessor();
+ try {
+ requestDest = jmsResourceFactory.lookupDestination(jmsBinding.getDestinationName());
+
+ if (requestDest == null){
+ if (jmsBinding.getDestinationCreate().equals(JMSBindingConstants.CREATE_ALLWAYS)) {
+ requestDest = jmsResourceFactory.createDestination(jmsBinding.getDestinationName());
+ } else {
+ throw new JMSBindingException("JMS Destination " +
+ jmsBinding.getDestinationName() +
+ " not found while registering binding " +
+ jmsBinding.getName() +
+ " invoker");
+ }
+ }
+
+ replyDest = jmsResourceFactory.lookupDestination(jmsBinding.getResponseDestinationName());
+
+ if (replyDest == null){
+ if (jmsBinding.getResponseDestinationCreate().equals(JMSBindingConstants.CREATE_ALLWAYS)) {
+ replyDest = jmsResourceFactory.createDestination(jmsBinding.getResponseDestinationName());
+ } else {
+ throw new JMSBindingException("JMS Response Destination " +
+ jmsBinding.getDestinationName() +
+ " not found while registering binding " +
+ jmsBinding.getName() +
+ " invoker");
+ }
+ }
+ } catch (NamingException e) {
+ throw new JMSBindingException(e);
+ }
+
+ }
+
+ public org.apache.tuscany.sca.invocation.Message invoke(org.apache.tuscany.sca.invocation.Message msg) {
+ try {
+ Object resp = invokeTarget((Object[])msg.getBody(), (short)0);
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ } catch (Throwable e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+ public Object invokeTarget(Object payload, final short sequence) throws InvocationTargetException {
+ try {
+ Session session = jmsResourceFactory.createSession();
+ try {
+
+ Destination replyToDest = (replyDest != null) ? replyDest : session.createTemporaryQueue();
+
+ Message requestMsg = sendRequest((Object[])payload, session, replyToDest);
+ Message replyMsg = receiveReply(session, replyToDest, requestMsg.getJMSMessageID());
+
+ return responseMessageProcessor.extractPayloadFromJMSMessage(replyMsg);
+
+ } finally {
+ session.close();
+ }
+ } catch (JMSException e) {
+ throw new InvocationTargetException(e);
+ } catch (NamingException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+ public void stop() throws NamingException, JMSException{
+ jmsResourceFactory.closeConnection();
+ }
+
+ protected Message sendRequest(Object[] payload, Session session, Destination replyToDest) throws JMSException {
+
+ Message requestMsg = requestMessageProcessor.insertPayloadIntoJMSMessage(session, payload);
+
+ requestMsg.setJMSDeliveryMode(jmsBinding.getDeliveryMode());
+ requestMsg.setJMSPriority(jmsBinding.getPriority());
+
+ requestMessageProcessor.setOperationName(operationName, requestMsg);
+ requestMsg.setJMSReplyTo(replyToDest);
+
+ MessageProducer producer = session.createProducer(requestDest);
+ try {
+ producer.send(requestMsg);
+ } finally {
+ producer.close();
+ }
+ return requestMsg;
+ }
+
+ protected Message receiveReply(Session session, Destination replyToDest, String requestMsgId) throws JMSException,
+ NamingException {
+ String msgSelector = "JMSCorrelationID = '" + requestMsgId + "'";
+ MessageConsumer consumer = session.createConsumer(replyToDest, msgSelector);
+ Message replyMsg;
+ try {
+ jmsResourceFactory.startConnection();
+ replyMsg = consumer.receive(jmsBinding.getTimeToLive());
+ } finally {
+ consumer.close();
+ }
+ return replyMsg;
+ }
+
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java
new file mode 100644
index 0000000000..418a6467bd
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.binding.jms.provider;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.naming.NamingException;
+
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
+import org.apache.tuscany.sca.core.invocation.MessageFactoryImpl;
+import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+public class JMSBindingListener implements MessageListener {
+
+
+ private JMSBinding jmsBinding;
+ private JMSResourceFactory jmsResourceFactory;
+ private RuntimeComponentService service;
+ private JMSMessageProcessor requestMessageProcessor;
+ private JMSMessageProcessor responseMessageProcessor;
+ private String correlationScheme;
+ private MessageFactory messageFactory;
+ //private Method operationMethod;
+
+ public JMSBindingListener(JMSBinding jmsBinding,
+ JMSResourceFactory jmsResourceFactory,
+ RuntimeComponentService service)
+ throws NamingException {
+ this.jmsBinding = jmsBinding;
+ this.jmsResourceFactory = jmsResourceFactory;
+ this.service = service;
+ requestMessageProcessor = jmsBinding.getRequestMessageProcessor();
+ responseMessageProcessor = jmsBinding.getResponseMessageProcessor();
+ correlationScheme = jmsBinding.getCorrelationScheme();
+ messageFactory = new MessageFactoryImpl();
+ }
+
+ public void onMessage(Message requestJMSMsg) {
+ try {
+ Object responsePayload = invokeService(requestJMSMsg);
+ sendReply(requestJMSMsg, responsePayload);
+ } catch (Exception e) {
+ sendFaultReply(requestJMSMsg, e);
+ }
+ }
+
+ /**
+ * Turn the JMS message back into a Tuscany message and invoke the
+ * target component
+ *
+ * @param requestJMSMsg
+ * @return
+ * @throws JMSException
+ * @throws InvocationTargetException
+ */
+ protected Object invokeService(Message requestJMSMsg)
+ throws JMSException, InvocationTargetException {
+
+ String operationName = requestMessageProcessor.getOperationName(requestJMSMsg);
+ Object requestPayload = requestMessageProcessor.extractPayloadFromJMSMessage(requestJMSMsg);
+
+ org.apache.tuscany.sca.invocation.Message requestMsg = messageFactory.createMessage();
+
+ requestMsg.setBody(requestPayload);
+
+ org.apache.tuscany.sca.invocation.Message workContext = ThreadMessageContext.getMessageContext();
+ ThreadMessageContext.setMessageContext(requestMsg);
+
+ try {
+ /* TODO - work out how to do this bit
+
+ if (isConversational() && conversationID != null) {
+ requestMsg.setConversationID(conversationID);
+ } else {
+ requestMsg.setConversationID(null);
+ }
+ */
+ // get the operation object
+ List<Operation> opList = service.getInterfaceContract().getInterface().getOperations();
+
+ Operation operation = null;
+
+ for(Operation op : opList){
+ if ( op.getName().equals(operationName)) {
+ operation = op;
+ break;
+ }
+ }
+
+ if ( operation != null ){
+
+ // get the component invoker
+ Invoker invoker = service.getInvoker(jmsBinding, operation);
+
+ org.apache.tuscany.sca.invocation.Message responseMsg = invoker.invoke(requestMsg);
+
+ if (responseMsg.isFault()) {
+ throw new InvocationTargetException((Throwable)responseMsg.getBody());
+ }
+ return responseMsg.getBody();
+ } else {
+ throw new JMSBindingException("Can't find operation " + operationName );
+ }
+
+ } finally {
+ ThreadMessageContext.setMessageContext(workContext);
+ }
+ }
+
+ protected void sendReply(Message requestJMSMsg, Object responsePayload) {
+ try {
+
+ if (requestJMSMsg.getJMSReplyTo() == null) {
+ // assume no reply is expected
+ return;
+ }
+
+ Session session = jmsResourceFactory.createSession();
+ Message replyJMSMsg = responseMessageProcessor.insertPayloadIntoJMSMessage(session, responsePayload);
+
+ replyJMSMsg.setJMSDeliveryMode(requestJMSMsg.getJMSDeliveryMode());
+ replyJMSMsg.setJMSPriority(requestJMSMsg.getJMSPriority());
+
+ if (correlationScheme == null ||
+ JMSBindingConstants.CORRELATE_MSG_ID.equalsIgnoreCase(correlationScheme)) {
+ replyJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSMessageID());
+ } else if (JMSBindingConstants.CORRELATE_CORRELATION_ID.equalsIgnoreCase(correlationScheme)) {
+ replyJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSCorrelationID());
+ }
+
+ Destination destination = requestJMSMsg.getJMSReplyTo();
+ MessageProducer producer = session.createProducer(destination);
+
+ producer.send(replyJMSMsg);
+
+ producer.close();
+ session.close();
+
+ } catch (JMSException e) {
+ throw new JMSBindingException(e);
+ } catch (NamingException e) {
+ throw new JMSBindingException(e);
+ }
+ }
+
+ protected void sendFaultReply(Message requestJMSMsg, Exception e) {
+ sendReply(requestJMSMsg, new JMSBindingException("exception invoking JMS service", e));
+ }
+
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java
new file mode 100644
index 0000000000..b61ccaaaee
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms.provider;
+
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+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;
+
+
+
+/**
+ * A factory from creating the JMS binding provider.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JMSBindingProviderFactory implements BindingProviderFactory<JMSBinding> {
+
+ public JMSBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, JMSBinding binding) {
+ return new JMSBindingReferenceBindingProvider(component, reference, binding);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, JMSBinding binding) {
+ return new JMSBindingServiceBindingProvider(component, service, binding);
+ }
+
+ public Class<JMSBinding> getModelType() {
+ return JMSBinding.class;
+ }
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java
new file mode 100644
index 0000000000..7c5b677745
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms.provider;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
+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.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+
+/**
+ * Implementation of the JMS reference binding provider.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JMSBindingReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private RuntimeComponentReference reference;
+ private JMSBinding jmsBinding;
+ private List<JMSBindingInvoker> jmsBindingInvokers = new ArrayList<JMSBindingInvoker>();
+
+ public JMSBindingReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ JMSBinding binding) {
+ this.reference = reference;
+ this.jmsBinding = binding;
+
+ }
+
+ public Invoker createInvoker(Operation operation, boolean isCallback) {
+
+ if (jmsBinding.getDestinationName().equals(JMSBindingConstants.DEFAULT_DESTINATION_NAME)){
+ throw new JMSBindingException("No destination specified for reference " +
+ reference.getName());
+ }
+
+ if (jmsBinding.getResponseDestinationName().equals(JMSBindingConstants.DEFAULT_RESPONSE_DESTINATION_NAME)){
+ throw new JMSBindingException("No response destination specified for reference " +
+ reference.getName());
+ }
+/* The following doesn't work as I can't get to the
+ * target list on the composite reference
+ // if the default destination queue name is set
+ // set the destination queue name to the wired service name
+ // so that any wires can be assured a unique endpoint.
+
+ if (jmsBinding.getDestinationName().equals(JMSBindingConstants.DEFAULT_DESTINATION_NAME)){
+ // get the name of the target service
+ List<ComponentService> targets = reference.getTargets();
+
+ if (targets.size() < 1){
+ throw new JMSBindingException("No target specified for reference " +
+ reference.getName() +
+ " so destination queue name can't be determined");
+ }
+
+ if (targets.size() > 1){
+ throw new JMSBindingException("More than one target specified for reference " +
+ reference.getName() +
+ " so destination queue name can't be determined");
+ }
+
+ ComponentService service = targets.get(0);
+ jmsBinding.setDestinationName(service.getName());
+ }
+
+
+ // if the default response queue name is set
+ // set the response queue to the names of this
+ // reference
+ if (jmsBinding.getResponseDestinationName().equals(JMSBindingConstants.DEFAULT_RESPONSE_DESTINATION_NAME)){
+ jmsBinding.setResponseDestinationName(reference.getName());
+ }
+*/
+ if (isCallback) {
+ throw new UnsupportedOperationException();
+ } else {
+ JMSBindingInvoker invoker = new JMSBindingInvoker(jmsBinding,
+ operation);
+ jmsBindingInvokers.add(invoker);
+ return invoker;
+ }
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ public void start() {
+
+ }
+
+ public void stop() {
+ try {
+ for (JMSBindingInvoker invoker : jmsBindingInvokers) {
+ invoker.stop();
+
+ }
+ } catch (Exception e) {
+ throw new JMSBindingException("Error stopping JMSReferenceBinding", e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java
new file mode 100644
index 0000000000..f6f34324f2
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.jms.provider;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+import javax.naming.NamingException;
+
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Implementation of the JMS service binding provider.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JMSBindingServiceBindingProvider implements ServiceBindingProvider {
+
+
+ private RuntimeComponentService service;
+ private JMSBinding jmsBinding;
+ private JMSResourceFactory jmsResourceFactory;
+ private MessageConsumer consumer;
+
+ public JMSBindingServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ JMSBinding binding) {
+ this.service = service;
+ this.jmsBinding = binding;
+
+ jmsResourceFactory = jmsBinding.getJmsResourceFactory();
+
+ // if the default destination queue names is set
+ // set the destinate queue name to the reference name
+ // so that any wires can be assured a unique endpoint.
+ if (jmsBinding.getDestinationName().equals(JMSBindingConstants.DEFAULT_DESTINATION_NAME)){
+ //jmsBinding.setDestinationName(service.getName());
+ throw new JMSBindingException("No destination specified for service " +
+ service.getName());
+ }
+
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return service.getInterfaceContract();
+ }
+
+ public void start() {
+
+ try {
+ registerListerner();
+ } catch (Exception e) {
+ throw new JMSBindingException("Error starting JMSServiceBinding", e);
+ }
+ }
+
+ public void stop() {
+ try {
+ consumer.close();
+ jmsResourceFactory.closeConnection();
+ } catch (Exception e) {
+ throw new JMSBindingException("Error stopping JMSServiceBinding", e);
+ }
+ }
+
+ private void registerListerner() throws NamingException, JMSException {
+
+ Session session = jmsResourceFactory.createSession();
+ Destination destination = jmsResourceFactory.lookupDestination(jmsBinding.getDestinationName());
+
+ if (destination == null){
+ if (jmsBinding.getDestinationCreate().equals(JMSBindingConstants.CREATE_ALLWAYS)) {
+ destination = jmsResourceFactory.createDestination(jmsBinding.getDestinationName());
+ } else {
+ throw new JMSBindingException("JMS Destination " +
+ jmsBinding.getDestinationName() +
+ "not found while registering service " +
+ service.getName() +
+ " listener");
+ }
+ }
+
+ consumer = session.createConsumer(destination);
+
+ // TODO - We assume the target is a Java class here!!!
+ //Class<?> aClass = getTargetJavaClass(getBindingInterfaceContract().getInterface());
+ // Object instance = component.createSelfReference(aClass).getService();
+
+ consumer.setMessageListener(new JMSBindingListener(jmsBinding, jmsResourceFactory, service));
+
+ jmsResourceFactory.startConnection();
+
+ }
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.java
new file mode 100644
index 0000000000..f51b62b5ac
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.binding.jms.provider;
+
+import javax.jms.Message;
+import javax.jms.Session;
+
+/**
+ * Interface for a component that does operation selection and message payload
+ * processing
+ */
+public interface JMSMessageProcessor {
+
+ /**
+ * Get the operation name from a JMS Message
+ */
+ public abstract String getOperationName(Message message);
+
+ /**
+ * Set the operation name on a JMS Message
+ */
+ public abstract void setOperationName(String operationName, Message message);
+
+ /**
+ * Extracts the payload from a JMS Message
+ */
+ public abstract Object extractPayloadFromJMSMessage(Message msg);
+
+ /**
+ * Create a JMS Message containing the payload
+ */
+ public abstract Message insertPayloadIntoJMSMessage(Session session, Object payload);
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorImpl.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorImpl.java
new file mode 100644
index 0000000000..0a0a4cde2b
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorImpl.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.binding.jms.provider;
+
+import java.io.Serializable;
+import java.io.StringReader;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.ObjectMessage;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
+
+public class JMSMessageProcessorImpl implements JMSMessageProcessor {
+
+ protected String operationPropertyName;
+ protected boolean xmlFormat;
+
+ public JMSMessageProcessorImpl(JMSBinding jmsBinding) {
+ this.operationPropertyName = jmsBinding.getOperationSelectorPropertyName();
+ this.xmlFormat = jmsBinding.getXMLFormat();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#getOperationName(javax.jms.Message)
+ */
+ public String getOperationName(Message message) {
+ try {
+
+ return message.getStringProperty(operationPropertyName);
+
+ } catch (JMSException e) {
+ throw new JMSBindingException("Exception retreiving operation name from message", e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#setOperationName(javax.jms.Message,
+ * java.lang.String)
+ */
+ public void setOperationName(String operationName, Message message) {
+ try {
+
+ message.setStringProperty(operationPropertyName, operationName);
+
+ } catch (JMSException e) {
+ throw new JMSBindingException("Exception setting the operation name on message", e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#extractPayload(javax.jms.Session,
+ * java.lang.Object)
+ */
+ public Message insertPayloadIntoJMSMessage(Session session, Object o) {
+ if (xmlFormat) {
+ return createXMLJMSMessage(session, o);
+ } else {
+ return createObjectJMSMessage(session, o);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#extractPayload(javax.jms.Message)
+ */
+ public Object extractPayloadFromJMSMessage(Message msg) {
+ if (xmlFormat) {
+ return extractXMLPayload(msg);
+ } else {
+ return extractObjectPayload(msg);
+ }
+ }
+
+ protected Object extractXMLPayload(Message msg) {
+ try {
+
+ String xml = ((TextMessage)msg).getText();
+
+ XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xml));
+ StAXOMBuilder builder = new StAXOMBuilder(reader);
+ OMElement omElement = builder.getDocumentElement();
+
+ return new Object[] {omElement};
+
+ } catch (XMLStreamException e) {
+ throw new JMSBindingException(e);
+ } catch (JMSException e) {
+ throw new JMSBindingException(e);
+ }
+ }
+
+ protected Object extractObjectPayload(Message msg) {
+ try {
+
+ return ((ObjectMessage)msg).getObject();
+
+ } catch (JMSException e) {
+ throw new JMSBindingException(e);
+ }
+ }
+
+ protected Message createXMLJMSMessage(Session session, Object o) {
+ try {
+
+ TextMessage message = session.createTextMessage();
+
+ if (o instanceof OMElement) {
+ message.setText(o.toString());
+ } else {
+ message.setText(((Object[])o)[0].toString());
+ }
+
+ return message;
+
+ } catch (JMSException e) {
+ throw new JMSBindingException(e);
+ }
+ }
+
+ protected Message createObjectJMSMessage(Session session, Object o) {
+ try {
+
+ ObjectMessage message = session.createObjectMessage(); // default
+ message.setObject((Serializable)o);
+ return message;
+
+ } catch (JMSException e) {
+ throw new JMSBindingException(e);
+ }
+ }
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java
new file mode 100644
index 0000000000..21a6847840
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.binding.jms.provider;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Session;
+import javax.naming.NamingException;
+
+/*
+ * Brings together the JMS binding description and the
+ * API used for generating and manageing JMS resources
+ */
+
+public interface JMSResourceFactory {
+
+ public abstract Connection getConnection() throws NamingException, JMSException;
+
+ public abstract Session createSession() throws JMSException, NamingException;
+
+ public abstract void startConnection() throws JMSException, NamingException;
+
+ public abstract void closeConnection() throws JMSException, NamingException;
+
+ public abstract Destination lookupDestination(String jndiName) throws NamingException;
+
+ public abstract Destination createDestination(String jndiName) throws NamingException;
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryActiveMQImpl.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryActiveMQImpl.java
new file mode 100644
index 0000000000..8d9a0ef210
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryActiveMQImpl.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.binding.jms.provider;
+
+import java.util.Properties;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Session;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+
+/**
+ * Abstracts away any JMS provide specific feature from the JMS binding
+ *
+ * @version $Rev$ $Date$
+ */
+public class JMSResourceFactoryActiveMQImpl implements JMSResourceFactory {
+
+ private JMSBinding jmsBinding;
+ private Connection connection;
+ private Context context;
+ private boolean isConnectionStarted;
+
+ public JMSResourceFactoryActiveMQImpl(JMSBinding jmsBinding) {
+ this.jmsBinding = jmsBinding;
+ }
+
+ /*
+ * This is a simple implementation where a connection is created per binding
+ * Ideally the resource factory should be able to leverage the host
+ * environment to provide connection pooling if it can. E.g. if Tuscany is
+ * running inside an AppServer Then we could leverage the JMS resources it
+ * provides
+ *
+ * @see org.apache.tuscany.binding.jms.JMSResourceFactory#getConnection()
+ */
+ public Connection getConnection() throws NamingException, JMSException {
+ if (connection == null) {
+ createConnection();
+ }
+ return connection;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.binding.jms.JMSResourceFactory#createSession()
+ */
+ public Session createSession() throws JMSException, NamingException {
+ return getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.binding.jms.JMSResourceFactory#startConnection()
+ */
+ public void startConnection() throws JMSException, NamingException {
+ if (!isConnectionStarted) {
+ getConnection().start();
+ isConnectionStarted = true;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.binding.jms.JMSResourceFactory#closeConnection()
+ */
+ public void closeConnection() throws JMSException, NamingException {
+ if (connection != null) {
+ connection.close();
+ }
+ }
+
+ private void createConnection() throws NamingException, JMSException {
+ if (context == null) {
+ createInitialContext();
+ }
+ ConnectionFactory connectionFactory = (ConnectionFactory)context.lookup(jmsBinding.getConnectionFactoryName());
+ connection = connectionFactory.createConnection();
+ }
+
+ private void createInitialContext() throws NamingException {
+ Properties props = new Properties();
+ props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
+ jmsBinding.getInitialContextFactoryName().trim());
+ props.setProperty(Context.PROVIDER_URL,
+ jmsBinding.getJndiURL().trim());
+
+ context = new InitialContext(props);
+ }
+
+ public Destination lookupDestination(String jndiName) throws NamingException {
+ if (context == null) {
+ createInitialContext();
+ }
+
+ Destination dest = null;
+
+ try {
+ dest = (Destination)context.lookup(jndiName);
+ } catch(NamingException ex){
+
+ }
+ return dest;
+ }
+
+ /**
+ * You can create a destination in ActiveMQ (and have it appear in JNDI)
+ * by putting "dynamicQueues/" in front of the queue name being looked up
+ *
+ */
+ public Destination createDestination(String jndiName) throws NamingException {
+ return lookupDestination("dynamicQueues/" + jndiName);
+ }
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..ac37a0f26b
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.binding.jms.impl.JMSBindingProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#binding.jms,model=org.apache.tuscany.sca.binding.jms.impl.JMSBinding
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
new file mode 100644
index 0000000000..dec0991984
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the binding extension
+org.apache.tuscany.sca.binding.jms.provider.JMSBindingProviderFactory;model=org.apache.tuscany.sca.binding.jms.impl.JMSBinding
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java
new file mode 100644
index 0000000000..490661dc91
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.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 org.apache.tuscany.sca.binding.jms;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldClientImpl implements HelloWorldService {
+ private HelloWorldService serviceA;
+
+ @Reference
+ public void setServiceA(HelloWorldService service) {
+ this.serviceA = service;
+ }
+
+ private HelloWorldService serviceB;
+
+ @Reference
+ public void setServiceB(HelloWorldService service) {
+ this.serviceB = service;
+ }
+
+ public String sayHello(String name) {
+ return "ServiceA says " +
+ serviceA.sayHello(name + "-A") +
+ " ServiceB says " +
+ serviceB.sayHello(name + "-B");
+ }
+
+
+
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java
new file mode 100644
index 0000000000..abb29aec4c
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.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 org.apache.tuscany.sca.binding.jms;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorldService {
+ String sayHello(String name);
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java
new file mode 100644
index 0000000000..192266e73a
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.binding.jms;
+
+public class HelloWorldServiceImpl implements HelloWorldService {
+
+ public String sayHello(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSTestCase.java b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSTestCase.java
new file mode 100644
index 0000000000..7427f3620b
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSTestCase.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.binding.jms;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class JMSTestCase {
+
+ private static BrokerService broker;
+ private static HelloWorldService helloWorldService;
+ private static SCADomain scaDomain;
+
+ /*
+ * This test is a bit strange for two reasons
+ * 1/ starting and stopping the broker repeatedly for multiple tests
+ * sometimes leads to orphaned lock files being left on disc
+ * 2/ it doesn't seem possible to load a single composite file
+ * at the moment so I've put all the components for the test
+ * in one. This makes it very difficult to test for failure
+ * cases at this level.
+ * For these reasons setup happens at a class level at the moment
+ */
+
+ @BeforeClass
+ public static void oneTimeSetUp() throws Exception {
+ // start the activemq broker
+ broker = new BrokerService();
+ broker.addConnector("tcp://localhost:61616");
+ broker.start();
+
+ // start the SCA runtime
+ scaDomain = SCADomain.newInstance("JMSBindingTest.composite");
+ }
+
+ @AfterClass
+ public static void oneTimeTearDown() throws Exception {
+ scaDomain.close();
+
+ broker.stop();
+ // only available in 4.2 snapshot
+ //broker.waitUntilStopped();
+ }
+
+/* At the moment I can't get at the target list in order to auto generate queue names
+ * so binding.jms with no configuration doesn't work
+ @Test
+ public void testHelloWorldMinimal() throws Exception {
+ helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldMinimalClientComponent");
+ assertEquals("Hello Fred", helloWorldService.sayHello("Fred"));
+ }
+*/
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldCreateClientComponent");
+ assertEquals("ServiceA says Hello Fred-A ServiceB says Hello Fred-B", helloWorldService.sayHello("Fred"));
+ }
+
+
+
+}
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/resources/JMSBindingTest.composite b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/resources/JMSBindingTest.composite
new file mode 100644
index 0000000000..81ae51c9cd
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/resources/JMSBindingTest.composite
@@ -0,0 +1,110 @@
+<?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"
+ name="JMSBindingTestComposite">
+ <!--
+ <component name="HelloWorldMinimalClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ </component>
+
+ <reference name="HelloWorldMinimalReferenceA"
+ promote="HelloWorldMinimalClientComponent/serviceA"
+ target="HelloWorldMinimalServiceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService"/>
+ <binding.jms/>
+ </reference>
+
+ <reference name="HelloWorldMinimalReferenceB"
+ promote="HelloWorldMinimalClientComponent/serviceB"
+ target="HelloWorldMinimalServiceB">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService"/>
+ <binding.jms/>
+ </reference>
+ -->
+
+ <component name="HelloWorldCreateClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ </component>
+
+ <reference name="HelloWorldCreateReferenceA"
+ promote="HelloWorldCreateClientComponent/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService"/>
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </reference>
+
+ <reference name="HelloWorldCreateReferenceB"
+ promote="HelloWorldCreateClientComponent/serviceB">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService"/>
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueB" create="always"/>
+ <response>
+ <destination name="RespQueueB" create="always"/>
+ </response>
+ </binding.jms>
+ </reference>
+
+
+
+ <service name="HelloWorldCreateServiceA"
+ promote="HelloWorldServiceAComponent">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService"/>
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ </binding.jms>
+ </service>
+ <!--
+ <service name="HelloWorldMinimalServiceA"
+ promote="HelloWorldServiceAComponent">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService"/>
+ <binding.jms/>
+ </service>
+ -->
+ <component name="HelloWorldServiceAComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldServiceImpl"/>
+ </component>
+
+
+
+ <service name="HelloWorldCreateServiceB" promote="HelloWorldServiceBComponent">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService"/>
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueB" create="always"/>
+ </binding.jms>
+ </service>
+ <!--
+ <service name="HelloWorldMinimalServiceB" promote="HelloWorldServiceBComponent">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService"/>
+ <binding.jms/>
+ </service>
+ -->
+ <component name="HelloWorldServiceBComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/resources/wsdl/helloworld.wsdl b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..ea53e13692
--- /dev/null
+++ b/sca-java-1.x/tags/0.99-incubating/modules/binding-jms/src/test/resources/wsdl/helloworld.wsdl
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsCallback">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetings1">
+ <complexType>
+ <sequence>
+ <element name="name" type="tns:NameType">
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+
+ <complexType name="NameType">
+ <sequence>
+ <element name="firstName" type="string"/>
+ <element name="lastName" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="getGreetings1Response">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsCallback">
+ <wsdl:part element="tns:getGreetingsCallback" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings1Request">
+ <wsdl:part element="tns:getGreetings1" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings1Response">
+ <wsdl:part element="tns:getGreetings1Response" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:portType name="HelloWorldCallback">
+ <wsdl:operation name="getGreetingsCallback">
+ <wsdl:input message="tns:getGreetingsCallback" name="getGreetingsCallback"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/sample-helloworldws-async-1.0-incubator-SNAPSHOT/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>