diff --git a/.gitignore b/.gitignore
index 83a414d1e..404b3156c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,19 +1,9 @@
-.project
+target
.classpath
-.settings/
-.bpmn/
-target/
-bin/
-components-file/bin/
-core/bin/
+.project
+.settings
.checkstyle
-transaction.log
+*.sw?
*.iml
*.ipr
-*.iws
-.xml
-.DS_Store
-.metadata/
-.idea
-.fbExcludeFilterFile
-.factorypath
+*.iws
\ No newline at end of file
diff --git a/LICENSE-2.0.txt b/LICENSE-2.0.txt
new file mode 100644
index 000000000..d64569567
--- /dev/null
+++ b/LICENSE-2.0.txt
@@ -0,0 +1,202 @@
+
+ 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/README b/README
new file mode 100644
index 000000000..d19ad69ba
--- /dev/null
+++ b/README
@@ -0,0 +1,2 @@
+This is the SwitchYard parent POM that SwitchYard projects like core and
+component inherit from.
diff --git a/assembly/pom.xml b/assembly/pom.xml
deleted file mode 100644
index b1177cc57..000000000
--- a/assembly/pom.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
- 4.0.0
-
- org.switchyard.quickstarts
- switchyard-quickstart-parent
- 2.0.0.Final
-
- switchyard-quickstart-distro
- jar
- SwitchYard : Quickstarts Distribution Assembly
- SwitchYard Quickstarts Distribution Assembly
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
-
-
- make-assembly
- package
-
- single
-
-
- false
- SwitchYard-Quickstarts
-
- ${basedir}/assembly.xml
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
-
-
diff --git a/bean-service/Readme.md b/bean-service/Readme.md
deleted file mode 100644
index d54ad207e..000000000
--- a/bean-service/Readme.md
+++ /dev/null
@@ -1,112 +0,0 @@
-
-Introduction
-============
-This quickstart demonstrates the usage of the bean component. This example shows a bean component
-service, OrderService, which is provided through the OrderServiceBean, and an InventoryService which
-is provided through the InventoryServiceBean implementation. Orders are submitted through the
-OrderService, and the OrderService then looks items up in the InventoryService to see if they are
-in stock and the order can be processed.
-
-This example is invoked through a SOAP gateway binding.
-
-
-
-Running the quickstart
-======================
-
-EAP
-----------
-1. Start EAP in standalone mode:
-
- ${AS}/bin/standalone.sh
-
-2. Build and deploy the Quickstart :
-
- mvn install -Pdeploy
-
-3. Submit a webservice request to invoke the SOAP gateway. There are a number of ways to do this :
- - Submit a request with your preferred SOAP client - src/test/resources/xml contains sample
- requests and the responses that you should see
- - Use the simple bundled SOAP client and the sample request XML e.g.
-
-```
- mvn exec:java
-```
-
- - SOAP-UI : Use the wsdl for this project (src/main/resources/wsdl/OrderService.wsdl) to create
- a soap-ui project. Use the sample request (src/test/resources/xml/soap-request.xml) as an
- example of a sample request. See the "Expected Output" heading for the expected results.
-
-4. Undeploy the quickstart:
- mvn clean -Pdeploy
-
-
-Wildfly
-----------
-1. Start Wildfly in standalone mode :
-
- ${WILDFLY}/bin/standalone.sh
-
-2. Build and deploy the Quickstart :
-
- mvn install -Pdeploy -Pwildfly
-
-3. To submit a webservice request to invoke the SOAP gateway :
-
-```
- mvn exec:java
-```
-
-
-4. Undeploy the quickstart:
- mvn clean -Pdeploy -Pwildfly
-
-
-Karaf
-----------
-1. Start the Karaf server :
-
- ${KARAF_HOME}/bin/karaf
-
-2. Add the features URL for the respective version of SwitchYard. Replace {SWITCHYARD-VERSION}
-with the version of SwitchYard that you are using (ex. 2.0.0):
-
-karaf@root> features:addurl mvn:org.switchyard.karaf/switchyard/{SWITCHYARD-VERSION}/xml/features
-
-3. Install the feature for the bean-service quickstart :
-
-karaf@root> features:install switchyard-quickstart-bean-service
-
-4. To submit a webservice request to invoke the SOAP gateway, run the quickstart client :
-
-```
-mvn exec:java -Pkaraf
-```
-
-
-5. Undeploy the quickstart:
-
-karaf@root> features:uninstall switchyard-quickstart-bean-service
-
-
-Expected Output
-===============
-```
-
-
-
-
-
-PO-19838-XYZ
-true
-Order Accepted
-
-
-
-
-```
-
-
-## Further Reading
-
-1. [Bean Service Documentation](https://docs.jboss.org/author/display/SWITCHYARD/Bean)
diff --git a/bean-service/pom.xml b/bean-service/pom.xml
deleted file mode 100644
index 08495d9bc..000000000
--- a/bean-service/pom.xml
+++ /dev/null
@@ -1,263 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-bean-service
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: bean-service
- Quickstart : Bean Service
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.bean.service
- true
- 9999
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-bean
-
-
- org.switchyard.components
- switchyard-component-soap
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-http
- test
-
-
- junit
- junit
- test
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
- org.switchyard.validate.config.model.ValidateSwitchYardScanner
-
-
-
-
-
- configure
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- test
- org.switchyard.quickstarts.bean.service.BeanClient
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- karaf
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
-
-
- org.switchyard.component.soap.client.port
- 8181/cxf
-
-
-
-
-
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/bom/pom.xml b/bom/pom.xml
new file mode 100644
index 000000000..b49437270
--- /dev/null
+++ b/bom/pom.xml
@@ -0,0 +1,295 @@
+
+
+
+ 4.0.0
+
+ org.jboss.integration-platform
+ jboss-integration-platform-parent
+ 6.0.0.CR24
+
+ org.switchyard
+ switchyard-bom
+ 2.1.0-SNAPSHOT
+ pom
+ SwitchYard BOM
+ The BOM for SwitchYard application development
+ http://switchyard.org
+
+ 6.0.0.CR24
+ 7.4.0.Final-redhat-19
+ 6.3.0.GA
+
+ 6.2.0.CR3
+ 6.2.0.CR3
+ 6.2.0.CR3
+
+
+
+
+ org.jboss.integration-platform
+ jboss-integration-platform-bom
+ ${version.ip.bom}
+ pom
+ import
+
+
+ org.kie
+ kie-bom
+ ${version.org.kie}
+ pom
+ import
+
+
+ org.drools
+ drools-bom
+ ${version.org.drools}
+ pom
+ import
+
+
+ org.jbpm
+ jbpm-bom
+ ${version.org.jbpm}
+ pom
+ import
+
+
+ org.jboss.bom
+ eap6-supported-artifacts
+ ${version.redhat.eap6.bom}
+ pom
+ import
+
+
+ org.jboss.as
+ jboss-as-parent
+ ${version.org.jboss.as}
+ pom
+ import
+
+
+
+
+
+ org.switchyard
+ switchyard-api
+ ${project.version}
+
+
+ org.switchyard
+ switchyard-deploy-webapp
+ ${project.version}
+
+
+ org.switchyard
+ switchyard-remote
+ ${project.version}
+
+
+ org.switchyard
+ switchyard-test
+ ${project.version}
+
+
+ org.switchyard
+ switchyard-transform
+ ${project.version}
+
+
+ org.switchyard
+ switchyard-validate
+ ${project.version}
+
+
+
+
+
+ org.switchyard.components
+ switchyard-component-bean
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-bpel
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-bpm
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-camel
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-camel-amqp
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-camel-atom
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-camel-core
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-camel-cxf
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-camel-file
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-camel-ftp
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-camel-jms
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-camel-jpa
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-camel-mail
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-camel-mqtt
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-camel-netty
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-camel-quartz
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-camel-rss
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-camel-sap
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-camel-sql
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-clojure
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-http
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-jca
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-resteasy
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-rules
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-sca
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-soap
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-test-mixin-activemq
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-test-mixin-amqp
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-test-mixin-cdi
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-test-mixin-hornetq
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-test-mixin-http
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-test-mixin-jca
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-test-mixin-naming
+ ${project.version}
+
+
+ org.switchyard.components
+ switchyard-component-test-mixin-smooks
+ ${project.version}
+
+
+ org.switchyard.quickstarts
+ switchyard-quickstart-testutil
+ ${project.version}
+
+
+
+
diff --git a/bpel-jms-binding/Readme.md b/bpel-jms-binding/Readme.md
deleted file mode 100644
index fda982176..000000000
--- a/bpel-jms-binding/Readme.md
+++ /dev/null
@@ -1,98 +0,0 @@
-Introduction
-============
-This quickstart demonstrates the use of a JMS binding for a BPEL service. Also of
-note : the Camel JMS binding in the quickstart uses WSDL as it's interface type
-instead of Java.
-
-
-
-
-
-Running the quickstart
-======================
-
-EAP
-----------
-1. Start EAP in standalone-full mode:
-
- ${AS}/bin/standalone.sh --server-config=standalone-full.xml
-
-2. Create an application user:
-
- ${AS}/bin/add-user.sh
-
- realm=ApplicationRealm user=guest password=guestp.1 group=guest
-
-3. Build and deploy the quickstart
-
- mvn install -Pdeploy
-
-4. Execute HornetQClient. See the "Expected Output" heading for the expected results.
-
- mvn exec:java
-
-5. Undeploy the quickstart:
- mvn clean -Pdeploy
-
-
-Wildfly
-----------
-1. Start Wildfly in standalone-full mode:
-
- ${WILDFLY}/bin/standalone.sh --server-config=standalone-full.xml
-
-2. Create an application user:
-
- ${WILDFLY}/bin/add-user.sh
- realm=ApplicationRealm user=guest password=guestp.1 group=guest
-
-3. Build and deploy the quickstart
-
- mvn install -Pwildfly -Pdeploy
-
-4. Execute HornetQClient. See the "Expected Output" heading for the expected results.
-
- mvn exec:java -Pwildfly
-
-5. Undeploy the quickstart:
-
- mvn clean -Pdeploy -Pwildfly
-
-
-Karaf
-----------
-1. Start the Karaf server :
-
-${KARAF_HOME}/bin/karaf
-
-2. Add the features URL for the respective version of SwitchYard. Replace {SWITCHYARD-VERSION}
-with the version of SwitchYard that you are using (ex. 2.0.0):
-
-karaf@root> features:addurl mvn:org.switchyard.karaf/switchyard/{SWITCHYARD-VERSION}/xml/features
-
-3. Install the feature for the bpel-jms-binding quickstart :
-
-karaf@root> features:install switchyard-quickstart-bpel-jms-binding
-
-4. To submit a webservice request to invoke the SOAP gateway, run the quickstart client :
-
-```
-mvn exec:java -Pkaraf
-```
-
-
-5. Undeploy the quickstart:
-
-karaf@root> features:uninstall switchyard-quickstart-bpel-jms-binding
-
-
-
-Expected Output
-===============
-```
-Message sent. Waiting for reply ...
-REPLY:
-
-Hello Skippy
-
-```
diff --git a/bpel-jms-binding/pom.xml b/bpel-jms-binding/pom.xml
deleted file mode 100644
index b6a20e722..000000000
--- a/bpel-jms-binding/pom.xml
+++ /dev/null
@@ -1,326 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-bpel-jms-binding
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: bpel-jms-binding
- Quickstart : BPEL Service : JMS Binding
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.bpel.jms.binding
- true
- 9999
- 1.6
- 1.6
- *
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
- 2.4.1.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-bpel
-
-
- org.switchyard.components
- switchyard-component-camel-jms
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-hornetq
- test
-
-
- org.apache.activemq
- activemq-client
- test
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
-
-
-
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
-
-
-
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- java
- test
- org.switchyard.quickstarts.bpel.service.hello.JMSClient
-
- Skippy
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- wildfly
-
- 9990
- true
- 8080
-
-
-
- org.hornetq
- hornetq-core-client
- ${version.wildfly.hornetq}
- test
-
-
- org.hornetq
- hornetq-jms-client
- ${version.wildfly.hornetq}
- test
-
-
- org.hornetq
- hornetq-server
- ${version.wildfly.hornetq}
- test
-
-
- org.hornetq
- hornetq-jms-server
- ${version.wildfly.hornetq}
- test
-
-
- org.hornetq
- hornetq-commons
- ${version.wildfly.hornetq}
- test
-
-
- org.hornetq
- hornetq-journal
- ${version.wildfly.hornetq}
- test
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
-
-
- hornetqmixin.port
- 8080
-
-
- hornetqmixin.http.upgrade.enabled
- true
-
-
-
-
-
-
-
-
- karaf
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
-
- activemq
- Skippy
-
-
-
-
-
-
-
-
diff --git a/bpel-loan-approval/pom.xml b/bpel-loan-approval/pom.xml
deleted file mode 100644
index 9b9c36534..000000000
--- a/bpel-loan-approval/pom.xml
+++ /dev/null
@@ -1,249 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-bpel-loan-approval
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: bpel-loan-approval
- Quickstart : BPEL Service : Loan Approval
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.bpel.loan.approval
- true
- 9999
- 1.6
- 1.6
- *
-
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-bpel
-
-
- org.switchyard.components
- switchyard-component-soap
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-http
- test
-
-
-
- ${project.artifactId}
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- test
- org.switchyard.quickstarts.bpel.service.BPELLoanClient
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- karaf
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
-
-
- org.switchyard.component.soap.client.port
- 8181/cxf
-
-
-
-
-
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/bpel-say-hello/pom.xml b/bpel-say-hello/pom.xml
deleted file mode 100644
index 9c1752063..000000000
--- a/bpel-say-hello/pom.xml
+++ /dev/null
@@ -1,252 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-bpel-say-hello
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: bpel-say-hello
- Quickstart : BPEL Service : Say Hello
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.bpel.say.hello
- true
- 9999
- 1.6
- 1.6
- 1.3.1
- *
-
-
- org.switchyard,org.switchyard.*
-
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-bpel
-
-
- org.switchyard.components
- switchyard-component-soap
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-http
- test
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- test
- org.switchyard.quickstarts.bpel.service.BPELHelloClient
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- karaf
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
-
-
- org.switchyard.component.soap.client.port
- 8181/cxf
-
-
-
-
-
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/bpel-simple-correlation/pom.xml b/bpel-simple-correlation/pom.xml
deleted file mode 100644
index 1e565f0da..000000000
--- a/bpel-simple-correlation/pom.xml
+++ /dev/null
@@ -1,248 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-bpel-simple-correlation
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: bpel-simple-correlation
- Quickstart : BPEL Service : Simple Correlation
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.bpel.simple.correlation
- true
- 9999
- 1.6
- 1.6
- *
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-bpel
-
-
- org.switchyard.components
- switchyard-component-soap
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-http
- test
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
- clean
-
- enforce
-
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- test
- org.switchyard.quickstarts.bpel.service.BPELCorrelationClient
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- karaf
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
-
-
- org.switchyard.component.soap.client.port
- 8181/cxf
-
-
-
-
-
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/bpel-xts-subordinate-wsba/bpel/pom.xml b/bpel-xts-subordinate-wsba/bpel/pom.xml
deleted file mode 100644
index c6feaf41a..000000000
--- a/bpel-xts-subordinate-wsba/bpel/pom.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
- 4.0.0
-
- org.switchyard.quickstarts
- switchyard-bpel-xts-subordinate-wsba
- 2.0.0.Final
-
- switchyard-bpel-xts-subordinate-wsba-bpel
- jar
- SwitchYard Quickstart: bpel-xts-subordinate-wsba - bpel
- Quickstart : BPEL Service : XTS Subordinate WSBA : Business Travel Process
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
- 1.6
- 1.6
-
-
-
- org.switchyard.components
- switchyard-component-bpel
-
-
- org.switchyard.components
- switchyard-component-soap
-
-
- org.switchyard.components
- switchyard-component-test-mixin-http
- test
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
-
-
-
-
-
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
-
-
-
-
-
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- java
- test
- org.switchyard.quickstarts.bpel.service.BPELClient
-
- ${project.build.directory}/test-classes/xml
-
- false
-
-
-
-
-
diff --git a/bpel-xts-subordinate-wsba/pom.xml b/bpel-xts-subordinate-wsba/pom.xml
deleted file mode 100644
index 23cd668d5..000000000
--- a/bpel-xts-subordinate-wsba/pom.xml
+++ /dev/null
@@ -1,139 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-bpel-xts-subordinate-wsba
- 2.0.0.Final
- pom
- SwitchYard Quickstart: bpel-xts-subordinate-wsba
- Quickstart : BPEL Service : XTS Subordinate WSBA
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
- true
- 9999
- 1.6
- 1.6
- 1.3.1
- 1.0.2.Final
-
-
- bpel
- ws
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
- clean
-
- enforce
-
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
- false
-
- true
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- dummy
- true
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/bpel-xts-subordinate-wsba/ws/pom.xml b/bpel-xts-subordinate-wsba/ws/pom.xml
deleted file mode 100644
index 44319930d..000000000
--- a/bpel-xts-subordinate-wsba/ws/pom.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
-
- 4.0.0
-
- org.switchyard.quickstarts
- switchyard-bpel-xts-subordinate-wsba
- 2.0.0.Final
-
- switchyard-bpel-xts-subordinate-wsba-ws
- ejb
- SwitchYard Quickstart: bpel-xts-subordinate-wsba - ws
- Quickstart : BPEL Service : XTS Subordinate WSBA : Airport Web Service
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
- 1.6
- 1.6
-
-
-
- org.jboss.jbossts.xts
- jbossxts
- api
- provided
-
-
- org.jboss.spec.javax.ejb
- jboss-ejb-api_3.1_spec
-
-
-
- ${project.artifactId}
-
-
- org.apache.maven.plugins
- maven-ejb-plugin
-
- 3.1
-
-
- true
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
- ${project.build.finalName}.jar
-
-
-
- deploy
- install
-
- deploy-only
-
-
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- dummy
- true
-
-
-
-
-
diff --git a/bpel-xts-wsat/bpel/pom.xml b/bpel-xts-wsat/bpel/pom.xml
deleted file mode 100644
index 7715f56ba..000000000
--- a/bpel-xts-wsat/bpel/pom.xml
+++ /dev/null
@@ -1,121 +0,0 @@
-
-
-
- 4.0.0
-
- org.switchyard.quickstarts
- switchyard-bpel-xts-wsat
- 2.0.0.Final
-
- switchyard-bpel-xts-wsat-bpel
- jar
- SwitchYard Quickstart: bpel-xts-wsat - bpel
- Quickstart : BPEL Service : XTS WSAT : Business Travel Process
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
- 1.6
- 1.6
-
-
- ${project.artifactId}
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
-
-
-
-
-
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
-
-
-
-
-
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- java
- test
- org.switchyard.quickstarts.bpel.service.BPELClient
-
- ${project.build.directory}/test-classes/xml
-
- false
-
-
-
-
-
-
- org.switchyard.quickstarts
- switchyard-bpel-xts-wsat-ws
- ${project.version}
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-bpel
-
-
- org.switchyard.components
- switchyard-component-soap
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-http
- test
-
-
-
diff --git a/bpel-xts-wsat/pom.xml b/bpel-xts-wsat/pom.xml
deleted file mode 100644
index 15e09324d..000000000
--- a/bpel-xts-wsat/pom.xml
+++ /dev/null
@@ -1,139 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-bpel-xts-wsat
- 2.0.0.Final
- pom
- SwitchYard Quickstart: bpel-xts-wsat
- Quickstart : BPEL Service : XTS WSAT
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
- true
- 9999
- 1.6
- 1.6
- 1.3.1
- 1.0.2.Final
-
-
- bpel
- ws
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
- clean
-
- enforce
-
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
- false
-
- true
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- dummy
- true
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/bpel-xts-wsat/ws/pom.xml b/bpel-xts-wsat/ws/pom.xml
deleted file mode 100644
index 75db290f7..000000000
--- a/bpel-xts-wsat/ws/pom.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
-
- 4.0.0
-
- org.switchyard.quickstarts
- switchyard-bpel-xts-wsat
- 2.0.0.Final
-
- switchyard-bpel-xts-wsat-ws
- ejb
- SwitchYard Quickstart: bpel-xts-wsat - ws
- Quickstart : BPEL Service : XTS WSAT : Airport Web Service
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
- 1.6
- 1.6
-
-
-
- org.jboss.jbossts.xts
- jbossxts
- api
- provided
-
-
- org.jboss.spec.javax.ejb
- jboss-ejb-api_3.1_spec
-
-
-
- ${project.artifactId}
-
-
- org.apache.maven.plugins
- maven-ejb-plugin
-
- 3.1
-
-
- true
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
- ${project.build.finalName}.jar
-
-
-
- deploy
- install
-
- deploy-only
-
-
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- dummy
- true
-
-
-
-
-
diff --git a/bpm-service/pom.xml b/bpm-service/pom.xml
deleted file mode 100644
index 5dfb90051..000000000
--- a/bpm-service/pom.xml
+++ /dev/null
@@ -1,260 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-bpm-service
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: bpm-service
- Quickstart : BPM Service
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.bpm.service
- true
- 9999
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-bpm
-
-
- org.switchyard.components
- switchyard-component-bean
-
-
- org.switchyard.components
- switchyard-component-soap
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-http
- test
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
-
-
- enforce-versions
- clean
-
- enforce
-
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- test
- org.switchyard.quickstarts.bpm.service.BPMClient
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- karaf
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
-
-
- org.switchyard.component.soap.client.port
- 8181/cxf
-
-
-
-
-
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/camel-amqp-binding/pom.xml b/camel-amqp-binding/pom.xml
deleted file mode 100644
index c930ac880..000000000
--- a/camel-amqp-binding/pom.xml
+++ /dev/null
@@ -1,218 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-amqp-binding
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: camel-amqp-binding
- Quickstart : Camel AMQP Binding
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.amqp.binding
- true
- org.switchyard.quickstarts.camel.amqp.binding.QpidServer
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.apache.qpid
- qpid-client
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-camel-amqp
-
-
- org.switchyard.components
- switchyard-component-bean
-
-
- org.switchyard.components
- switchyard-component-test-mixin-amqp
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.hamcrest
- hamcrest-core
- test
-
-
- org.hamcrest
- hamcrest-library
- test
-
-
- org.jboss.spec.javax.jms
- jboss-jms-api_1.1_spec
- test
-
-
-
- ${project.artifactId}
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- org.apache.qpid
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- java
- test
- ${maven.exec.mainClass}
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- client
-
- org.switchyard.quickstarts.camel.amqp.binding.QpidClient
-
-
-
-
diff --git a/camel-atom-binding/pom.xml b/camel-atom-binding/pom.xml
deleted file mode 100644
index 2c58d5cf9..000000000
--- a/camel-atom-binding/pom.xml
+++ /dev/null
@@ -1,234 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-atom-binding
- 2.0.0.Final
- SwitchYard Quickstart: camel-atom-binding
- Quickstart : Camel RSS Binding
- bundle
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.atom.binding
- true
- 9999
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-camel-atom
-
-
- org.switchyard.components
- switchyard-component-bean
-
-
- org.apache.ws.commons.axiom
- axiom-api
-
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.apache.abdera
- abdera-core
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- org.apache.abdera.abdera-parser, org.apache.abdera.abdera-i18n, org.apache.abdera.abdera-core, org.apache.ws.commons.axiom.axiom-impl
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/camel-bindy/Readme.md b/camel-bindy/Readme.md
deleted file mode 100644
index 7825fbdc7..000000000
--- a/camel-bindy/Readme.md
+++ /dev/null
@@ -1,103 +0,0 @@
-Introduction
-============
-This quickstart demonstrates the usage of the Camel Bindy component within a
-SwitchYard service. The service unmarshals a delimited String into Order
-objects, and then makes two changes to the Orders - it sets the
-price of any "Lucky Charms" order to 17, and it changes any "Grape Nuts"
-orders to "Cheerios".
-
-This example is invoked through a File gateway binding.
-
-Running the quickstart
-======================
-
-
-EAP
-----------
-1. Start EAP in standalone mode:
-
- ${AS}/bin/standalone.sh
-
-2. Build and deploy the Quickstart :
-
- mvn install -Pdeploy
-
-3.
-
-```
- Copy src/test/resources/file.txt to /tmp/inbox/file.txt
-```
-
-* (If on Windows, change the file binding in switchyard.xml to a Windows directory path)
-
-4. Undeploy the quickstart:
-
- mvn clean -Pdeploy
-
-
-Wildfly
-----------
-1. Start EAP in standalone mode:
-
- ${AS}/bin/standalone.sh
-
-2. Build and deploy the Quickstart :
-
- mvn install -Pdeploy -Pwildfly
-
-3.
-
-```
- Copy src/test/resources/file.txt to /tmp/inbox/file.txt
-```
-
-* (If on Windows, change the file binding in switchyard.xml to a Windows directory path)
-
-4. Undeploy the quickstart:
-
- mvn clean -Pdeploy -Pwildfly
-
-
-Karaf
-----------
-1. Start the Karaf server :
-
-${KARAF_HOME}/bin/karaf
-
-2. Add the features URL for the respective version of SwitchYard. Replace {SWITCHYARD-VERSION}
-with the version of SwitchYard that you are using (ex. 2.0.0):
-
-karaf@root> features:addurl mvn:org.switchyard.karaf/switchyard/{SWITCHYARD-VERSION}/xml/features
-
-3. Install the feature for the camel-bindy quickstart :
-
-karaf@root> features:install switchyard-quickstart-camel-bindy
-
-4.
-
-```
-Copy src/test/resources/file.txt to /tmp/inbox/file.txt
-```
-
-
-5. Undeploy the quickstart:
-
-karaf@root> features:uninstall switchyard-quickstart-camel-bindy
-
-
-Expected Output
-===============
-```
-[FileProcessorBean] 1|Fruit Loops|3.99
-2|Lucky Charms|4.99
-3|Grape Nuts|2.33
-
-Processed Message : 1|Fruit Loops|3.99
-2|Lucky Charms|17
-3|Cheerios|2.33
-```
-
-
-## Further Reading
-
-1. [Camel Bindy](http://camel.apache.org/bindy.html)
diff --git a/camel-bindy/pom.xml b/camel-bindy/pom.xml
deleted file mode 100644
index c3e4103fb..000000000
--- a/camel-bindy/pom.xml
+++ /dev/null
@@ -1,262 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-bindy
- 2.0.0.Final
- SwitchYard Quickstart: camel-bindy
- bundle
- Quickstart : Camel Bindy
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.bindy
- true
- 9999
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard.components
- switchyard-component-camel
-
-
- org.switchyard.components
- switchyard-component-camel-file
-
-
- org.switchyard.components
- switchyard-component-test-mixin-http
- test
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard
- switchyard-transform
-
-
- org.switchyard
- switchyard-validate
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.switchyard.components
- switchyard-component-bean
-
-
- org.apache.camel
- camel-bindy
-
-
-
-
- jboss-public-repository
- JBoss Public Maven Repository
- http://repository.jboss.org/nexus/content/groups/public
-
-
-
-
- jboss-public-repository
- JBoss Public Maven Repository
- http://repository.jboss.org/nexus/content/groups/public
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
- false
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- org.apache.camel.bindy
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
- clean
-
- enforce
-
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/camel-bus-cdi/pom.xml b/camel-bus-cdi/pom.xml
deleted file mode 100644
index a65ff1329..000000000
--- a/camel-bus-cdi/pom.xml
+++ /dev/null
@@ -1,257 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-bus-cdi
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: camel-bus-cdi
- Quickstart : Camel Exchange Bus CDI
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.bus.cdi
- true
- 9999
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-bean
-
-
- org.switchyard.components
- switchyard-component-soap
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-http
- test
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- test
- org.switchyard.quickstarts.camel.bus.CDIBusClient
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- karaf
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
-
-
- org.switchyard.component.soap.client.port
- 8181/cxf
-
-
-
-
-
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/camel-cxf-binding/pom.xml b/camel-cxf-binding/pom.xml
deleted file mode 100644
index 06a599137..000000000
--- a/camel-cxf-binding/pom.xml
+++ /dev/null
@@ -1,239 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-cxf-binding
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: CXF consumer
- Quickstart : CXF based Webservice consumer
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.cxf.binding
- true
- 9999
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard.components
- switchyard-component-camel
-
-
- org.switchyard.components
- switchyard-component-camel-cxf
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-soap
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-http
- test
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
- configure
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- test
- org.switchyard.quickstarts.camel.cxf.CamelCxfClient
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/camel-file-binding/pom.xml b/camel-file-binding/pom.xml
deleted file mode 100644
index 4711f4aa9..000000000
--- a/camel-file-binding/pom.xml
+++ /dev/null
@@ -1,224 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-file-binding
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: camel-file-binding
- Quickstart : Camel Binding
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.file.binding
- true
- 9999
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-camel-file
-
-
- org.switchyard.components
- switchyard-component-bean
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
-
- ${project.artifactId}
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/camel-ftp-binding/pom.xml b/camel-ftp-binding/pom.xml
deleted file mode 100644
index 621edfad7..000000000
--- a/camel-ftp-binding/pom.xml
+++ /dev/null
@@ -1,291 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-ftp-binding
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: camel-ftp-binding
- Quickstart : Camel FTP Binding
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.ftp.binding
- true
- 9999
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
- org.apache.sshd
- sshd-core
- 0.9.0
-
-
- org.apache.sshd
- sshd-sftp
- 0.9.0
-
-
- com.jcraft
- jsch
- 0.1.51
-
-
- org.bouncycastle
- bcpg-jdk15on
- 1.49
-
-
- org.bouncycastle
- bcpkix-jdk15on
- 1.49
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-camel-ftp
-
-
- org.switchyard.components
- switchyard-component-bean
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.apache.ftpserver
- ftpserver-core
- test
-
-
- commons-io
- commons-io
- test
-
-
- org.hamcrest
- hamcrest-core
- test
-
-
- org.apache.sshd
- sshd-core
- test
-
-
- org.apache.sshd
- sshd-sftp
- test
-
-
- com.jcraft
- jsch
- test
-
-
- org.bouncycastle
- bcpg-jdk15on
- test
-
-
- org.bouncycastle
- bcpkix-jdk15on
- test
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
- false
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/camel-hl7/pom.xml b/camel-hl7/pom.xml
deleted file mode 100644
index ae602d068..000000000
--- a/camel-hl7/pom.xml
+++ /dev/null
@@ -1,252 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-hl7
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: camel-hl7
- Quickstart : Camel HL7
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.hl7
- true
- 9999
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard.components
- switchyard-component-camel
-
-
- org.switchyard.components
- switchyard-component-camel-core
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard
- switchyard-transform
-
-
- org.apache.camel
- camel-hl7
-
-
- org.apache.camel
- camel-mina2
-
-
-
- ca.uhn.hapi
- hapi-osgi-base
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- org.apache.mina, org.apache.camel.mina2, org.apache.camel.hl7, ca.uhn.hapi-osgi-base
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- java
- test
- org.switchyard.quickstarts.camel.hl7example.HL7Client
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/camel-jaxb/pom.xml b/camel-jaxb/pom.xml
deleted file mode 100644
index e060b0161..000000000
--- a/camel-jaxb/pom.xml
+++ /dev/null
@@ -1,258 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-jaxb
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: camel-jaxb
- Quickstart : Camel JAXB
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.jaxb
- true
- 9999
- 1.6
- 1.6
- *
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.apache.camel
- camel-jaxb
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-http
-
-
- org.switchyard.components
- switchyard-component-camel
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-http
- test
-
-
- commons-io
- commons-io
- test
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- java
- test
- org.switchyard.quickstarts.camel.jaxb.JAXBClient
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- karaf
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
-
-
- org.switchyard.component.http.client.port
- 8181
-
-
-
-
-
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/camel-jms-binding/Readme.md b/camel-jms-binding/Readme.md
deleted file mode 100644
index be54f53bb..000000000
--- a/camel-jms-binding/Readme.md
+++ /dev/null
@@ -1,95 +0,0 @@
-Introduction
-============
-This quickstart demonstrates the usage of the Camel Component and it's binding feature, by binding
-to a JMS Queue. When a message arrives in this queue the service will be invoked.
-
-
-
-
-Running the quickstart
-======================
-
-
-EAP
-----------
-1. Start EAP in standalone-full mode:
-
- ${AS}/bin/standalone.sh --server-config=standalone-full.xml
-
-2. Create an application user:
-
- ${AS}/bin/add-user.sh
- realm=ApplicationRealm UserName=guest Password=guestp.1 Group=guest
-
-3. Build and deploy the quickstart
-
- mvn install -Pdeploy
-
-4. Execute HornetQClient
-
- mvn exec:java
-
-5. Check the server console for output from the service.
-
-6. Undeploy the quickstart:
-
- mvn clean -Pdeploy
-
-
-Wildfly
-----------
-1. Start EAP in standalone-full mode:
-
- ${AS}/bin/standalone.sh --server-config=standalone-full.xml
-
-2. Create an application user:
-
- ${AS}/bin/add-user.sh
- realm=ApplicationRealm UserName=guest Password=guestp.1 Group=guest
-
-3. Build and deploy the quickstart
-
- mvn install -Pdeploy -Pwildfly
-
-4. Execute HornetQClient
-
- mvn exec:java -Pwildfly
-
-5. Check the server console for output from the service.
-
-6. Undeploy the quickstart:
-
- mvn clean -Pdeploy -Pwildfly
-
-
-Karaf
-----------
-1. Start the Karaf server :
-
- ${KARAF_HOME}/bin/karaf
-
-2. Add the features URL for the respective version of SwitchYard. Replace {SWITCHYARD-VERSION}
-with the version of SwitchYard that you are using (ex. 2.0.0):
-
-karaf@root> features:addurl mvn:org.switchyard.karaf/switchyard/{SWITCHYARD-VERSION}/xml/features
-
-3. Install the feature for the camel-jms-binding quickstart :
-
-karaf@root> features:install switchyard-quickstart-camel-jms-binding
-
-4. To submit a jms request, run the quickstart client :
-
-```
- mvn exec:java -Pkaraf
-```
-
-
-5. Undeploy the quickstart:
-
-karaf@root> features:uninstall switchyard-quickstart-camel-jms-binding
-
-
-
-## Further Reading
-
-1. [JMS Binding Documentation](https://docs.jboss.org/author/display/SWITCHYARD/JMS)
diff --git a/camel-jms-binding/pom.xml b/camel-jms-binding/pom.xml
deleted file mode 100644
index 5c850b122..000000000
--- a/camel-jms-binding/pom.xml
+++ /dev/null
@@ -1,342 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-jms-binding
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: camel-jms-binding
- Quickstart : Camel JMS Binding
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.jms.binding
- true
- 9999
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
- 2.4.1.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-camel-jms
-
-
- org.switchyard.components
- switchyard-component-bean
-
-
- org.jboss.spec.javax.jms
- jboss-jms-api_1.1_spec
-
-
- org.apache.activemq
- activemq-client
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-hornetq
- test
-
-
- org.mockito
- mockito-all
- test
-
-
- org.hamcrest
- hamcrest-core
- test
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
-
-
-
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
-
-
-
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- java
- test
- org.switchyard.quickstarts.camel.jms.binding.JMSClient
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- wildfly
-
- 9990
- true
- 8080
-
-
-
- org.hornetq
- hornetq-core-client
- ${version.wildfly.hornetq}
- test
-
-
- org.hornetq
- hornetq-jms-client
- ${version.wildfly.hornetq}
- test
-
-
- org.hornetq
- hornetq-server
- ${version.wildfly.hornetq}
- test
-
-
- org.hornetq
- hornetq-jms-server
- ${version.wildfly.hornetq}
- test
-
-
- org.hornetq
- hornetq-commons
- ${version.wildfly.hornetq}
- test
-
-
- org.hornetq
- hornetq-journal
- ${version.wildfly.hornetq}
- test
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
-
-
- hornetqmixin.port
- 8080
-
-
- hornetqmixin.http.upgrade.enabled
- true
-
-
-
-
-
-
-
-
- karaf
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- activemq
-
-
-
-
-
-
-
diff --git a/camel-jpa-binding/pom.xml b/camel-jpa-binding/pom.xml
deleted file mode 100644
index 3ebedef80..000000000
--- a/camel-jpa-binding/pom.xml
+++ /dev/null
@@ -1,306 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-jpa-binding
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: camel-jpa-binding
- Quickstart : Camel JPA Binding
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.jpa.binding
- true
- 9999
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- java:jboss/datasources/ExampleDS
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard.components
- switchyard-component-bean
-
-
- org.switchyard.components
- switchyard-component-camel-jpa
-
-
- org.switchyard.components
- switchyard-component-camel-quartz
-
-
- org.hibernate
- hibernate-entitymanager
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.hamcrest
- hamcrest-core
- test
-
-
- com.h2database
- h2
- test
-
-
- org.mockito
- mockito-all
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-jca
- test
-
-
-
- ${project.artifactId}
-
-
- true
- src/main/resources
-
-
- false
- src/main/resources
-
- **/switchyard.xml
-
-
-
-
-
- org.apache.maven.plugins
- maven-resources-plugin
-
-
- resources
- process-resources
-
- resources
-
-
-
- ${*}
-
- false
-
-
-
- test-resources
- process-test-resources
-
- testResources
-
-
-
- ${*}
-
- false
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- ${jpa.persistence.datasource.name}
-
-
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
- META-INF/persistence.xml
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- wildfly
-
- 9990
-
-
-
- karaf
-
- osgi:service/jboss/datasources/ExampleDS
-
-
-
-
diff --git a/camel-mail-binding/pom.xml b/camel-mail-binding/pom.xml
deleted file mode 100644
index 718432090..000000000
--- a/camel-mail-binding/pom.xml
+++ /dev/null
@@ -1,235 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-mail-binding
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: camel-mail-binding
- Quickstart : Camel Mail Binding
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.mail.binding
- true
- 9999
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-camel-mail
-
-
- org.switchyard.components
- switchyard-component-bean
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.hamcrest
- hamcrest-core
- test
-
-
- org.jvnet.mock-javamail
- mock-javamail
- test
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/camel-mqtt-binding/pom.xml b/camel-mqtt-binding/pom.xml
deleted file mode 100644
index ddb28b997..000000000
--- a/camel-mqtt-binding/pom.xml
+++ /dev/null
@@ -1,255 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-mqtt-binding
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: camel-mqtt-binding
- Quickstart : Camel MQTT Binding
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.mqtt.binding
- true
- 9999
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
- 1.6
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-camel-mqtt
-
-
- org.switchyard.components
- switchyard-component-bean
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.apache.activemq
- activemq-broker
- test
-
-
- org.apache.activemq
- activemq-mqtt
- test
-
-
- org.jboss.spec.javax.jms
- jboss-jms-api_1.1_spec
- test
-
-
- org.fusesource.mqtt-client
- mqtt-client
- ${version.org.fusesource.mqtt-client}
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- java
- test
- org.switchyard.quickstarts.camel.mqtt.binding.MQTTClient
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/camel-netty-binding/pom.xml b/camel-netty-binding/pom.xml
deleted file mode 100644
index fede56e68..000000000
--- a/camel-netty-binding/pom.xml
+++ /dev/null
@@ -1,256 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-netty-binding
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: camel-netty-binding
- Quickstart : Camel Netty Binding
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.netty.binding
- true
- 9999
- org.switchyard.quickstarts.camel.netty.binding.TCPClient
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.apache.karaf.jaas.config,org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-camel-netty
-
-
- org.switchyard.components
- switchyard-component-bean
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.hamcrest
- hamcrest-core
- test
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
-
-
-
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
-
-
-
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- java
- test
- ${maven.exec.mainClass}
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- udp
-
- org.switchyard.quickstarts.camel.netty.binding.UDPClient
-
-
-
- deploy
-
- false
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/camel-quartz-binding/pom.xml b/camel-quartz-binding/pom.xml
deleted file mode 100644
index 6d0ec701c..000000000
--- a/camel-quartz-binding/pom.xml
+++ /dev/null
@@ -1,226 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-quartz-binding
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: camel-quartz-binding
- Quickstart : Camel Quartz Binding
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.quartz.binding
- true
- 9999
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard.components
- switchyard-component-camel-quartz
-
-
- org.switchyard.components
- switchyard-component-bean
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.hamcrest
- hamcrest-core
- test
-
-
- org.hamcrest
- hamcrest-library
- test
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/camel-rss-binding/pom.xml b/camel-rss-binding/pom.xml
deleted file mode 100644
index aee418f8a..000000000
--- a/camel-rss-binding/pom.xml
+++ /dev/null
@@ -1,239 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-rss-binding
- 2.0.0.Final
- SwitchYard Quickstart: camel-rss-binding
- Quickstart : Camel RSS Binding
- bundle
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.rss.binding
- true
- 9999
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-camel-rss
-
-
- org.switchyard.components
- switchyard-component-bean
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- rome
- rome
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
- rome.rome:1.0
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- java
- test
- org.switchyard.quickstarts.camel.rss.binding.RSSClient
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/camel-sap-binding/pom.xml b/camel-sap-binding/pom.xml
deleted file mode 100644
index 9b97b9fb1..000000000
--- a/camel-sap-binding/pom.xml
+++ /dev/null
@@ -1,237 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-sap-binding
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: camel-sap-binding
- Quickstart : Camel SAP Binding
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.sap.binding
- 1.6
- 1.6
- true
- 9999
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-camel-sap
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.switchyard.components
- switchyard-component-camel
-
-
- org.switchyard
- switchyard-transform
-
-
- org.switchyard
- switchyard-validate
-
-
- org.switchyard.components
- switchyard-component-bean
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/camel-saxon/pom.xml b/camel-saxon/pom.xml
deleted file mode 100644
index e07e04b6d..000000000
--- a/camel-saxon/pom.xml
+++ /dev/null
@@ -1,264 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-saxon
- 2.0.0.Final
- bundle
- org.switchyard.quickstarts:switchyard-camel-saxon
- Quickstart : Camel Saxon
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.saxon
- true
- 9999
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-bean
-
-
- org.switchyard.components
- switchyard-component-camel
-
-
- org.switchyard.components
- switchyard-component-soap
-
-
- org.apache.camel
- camel-saxon
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-http
- test
-
-
-
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- org.switchyard.quickstarts.camel.saxon.CamelSaxonClient
- test
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- karaf
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
-
-
- org.switchyard.component.soap.client.port
- 8181/cxf
-
-
-
-
-
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/camel-service/pom.xml b/camel-service/pom.xml
deleted file mode 100644
index 951065382..000000000
--- a/camel-service/pom.xml
+++ /dev/null
@@ -1,265 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-service
- 2.0.0.Final
- bundle
- SwitchYard Quickstart: camel-service
- Quickstart : Camel Service
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.service
- true
- 9999
- 1.6
- 1.6
- *
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.switchyard
- switchyard-remote
- test
-
-
- org.codehaus.groovy
- groovy-all
-
-
- org.switchyard.components
- switchyard-component-camel
-
-
- org.switchyard.components
- switchyard-component-sca
-
-
- org.apache.camel
- camel-ognl
-
-
- org.apache.camel
- camel-mvel
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- org.switchyard.quickstarts.camel.service.CamelServiceClient
- test
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- karaf
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
-
-
- org.switchyard.component.sca.client.port
- 8181
-
-
-
-
-
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/camel-soap-proxy/pom.xml b/camel-soap-proxy/pom.xml
deleted file mode 100644
index 1111c1b6d..000000000
--- a/camel-soap-proxy/pom.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-soap-proxy-parent
- 2.0.0.Final
- pom
- SwitchYard Quickstart: camel-soap-proxy parent
- Quickstart : Camel SOAP Proxy Parent
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
- true
- 9999
- 1.6
- 1.6
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
- org.switchyard.quickstarts
- switchyard-camel-soap-proxy-reverse
- ${project.version}
-
-
- org.switchyard.quickstarts
- switchyard-camel-soap-proxy-reverse-service
- ${project.version}
-
-
- org.switchyard.quickstarts
- switchyard-camel-soap-proxy
- ${project.version}
-
-
-
-
- reverse
- reverse-service
- soap-proxy
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- dummy
- true
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- wildfly
-
- 9990
-
-
-
-
diff --git a/camel-soap-proxy/reverse-service/pom.xml b/camel-soap-proxy/reverse-service/pom.xml
deleted file mode 100644
index f72067ed2..000000000
--- a/camel-soap-proxy/reverse-service/pom.xml
+++ /dev/null
@@ -1,128 +0,0 @@
-
-
-
- 4.0.0
-
- org.switchyard.quickstarts
- switchyard-camel-soap-proxy-parent
- 2.0.0.Final
- ../pom.xml
-
- switchyard-camel-soap-proxy-reverse-service
- war
- SwitchYard Quickstart: camel-soap-proxy-reverse-service
- Quickstart : Camel SOAP Proxy Reverse Service
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
- true
- 1.6
- 1.6
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard.quickstarts
- switchyard-camel-soap-proxy-reverse
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- dummy
- true
-
-
-
- maven-war-plugin
-
-
- false
- WEB-INF/jboss-web.xml,WEB-INF/lib/switchyard-camel-soap-proxy-reverse-**.jar
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.war
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.war
- ${deploy.skip}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
-
diff --git a/camel-soap-proxy/reverse/pom.xml b/camel-soap-proxy/reverse/pom.xml
deleted file mode 100644
index 27fd2cd1b..000000000
--- a/camel-soap-proxy/reverse/pom.xml
+++ /dev/null
@@ -1,112 +0,0 @@
-
-
-
- 4.0.0
-
- org.switchyard.quickstarts
- switchyard-camel-soap-proxy-parent
- 2.0.0.Final
- ../pom.xml
-
- switchyard-camel-soap-proxy-reverse
- bundle
- SwitchYard Quickstart: camel-soap-proxy reverse
- Quickstart : Camel SOAP Proxy Reverse
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
- 1.6
- 1.6
-
- org.switchyard.quickstarts.camel.soap.proxy
-
-
- javax.xml.ws.soap,
- javax.ws.rs.*;version="[1.1,3)",
- org.apache.cxf.*;version="[2,4)",
- org.switchyard.quickstarts.camel.soap.proxy
-
-
-
-
-
- org.apache.cxf
- cxf-rt-frontend-jaxrs
-
-
- org.apache.cxf
- cxf-rt-frontend-jaxws
-
-
-
- ${project.artifactId}
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- dummy
- true
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${project.name}
- ${project.groupId}.${project.artifactId}
- ${switchyard.osgi.import}
- {maven-resources}
- ${switchyard.osgi.dynamic}
- <_failok>true
- !*
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
diff --git a/camel-soap-proxy/soap-proxy/pom.xml b/camel-soap-proxy/soap-proxy/pom.xml
deleted file mode 100644
index d9528caa7..000000000
--- a/camel-soap-proxy/soap-proxy/pom.xml
+++ /dev/null
@@ -1,208 +0,0 @@
-
-
-
- 4.0.0
-
- org.switchyard.quickstarts
- switchyard-camel-soap-proxy-parent
- 2.0.0.Final
- ../pom.xml
-
- switchyard-camel-soap-proxy
- bundle
- SwitchYard Quickstart: camel-soap-proxy
- Quickstart : Camel SOAP Proxy
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.soap.proxy
- true
- 1.6
- 1.6
-
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension;
- filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
-
-
-
- org.switchyard.components
- switchyard-component-soap
-
-
- org.switchyard.components
- switchyard-component-camel
-
-
- org.switchyard.quickstarts
- switchyard-camel-soap-proxy-reverse
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-http
- test
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
- configure
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
- test
- org.switchyard.quickstarts.camel.soap.proxy.CamelClient
- false
-
- ${project.build.directory}/test-classes/xml/soap-request.xml
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${project.name}
- ${bundle.symbolic.name}
- ${switchyard.osgi.import}
- {maven-resources},
- META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.dynamic}
- <_failok>true
- !*
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- karaf
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
-
-
- org.switchyard.component.soap.client.port
- 8181/cxf
-
-
- org.switchyard.component.soap.standalone.dir
- cxf/reverseService
-
-
-
-
-
-
-
-
-
diff --git a/camel-sql-binding/pom.xml b/camel-sql-binding/pom.xml
deleted file mode 100644
index ed88eed99..000000000
--- a/camel-sql-binding/pom.xml
+++ /dev/null
@@ -1,316 +0,0 @@
-
-
-
- 4.0.0
- org.switchyard.quickstarts
- switchyard-camel-sql-binding
- 2.0.0.Final
- SwitchYard Quickstart: camel-sql-binding
- Quickstart : Camel SQL Binding
- http://switchyard.org
-
- JBoss by Red Hat
- http://jboss.org
-
-
-
- SwitchYard committers
-
-
-
- scm:git:https://github.com/jboss-switchyard/quickstarts.git
- scm:git:ssh://git@github.com:jboss-switchyard/quickstarts.git
- http://github.com/jboss-switchyard/quickstarts
-
-
-
- Apache License, Version 2.0
- repo
- http://www.apache.org/licenses/LICENSE-2.0.html
-
-
-
-
- ${project.groupId}.switchyard.camel.sql.binding
- true
- 9999
- 1.6
- 1.6
- *
-
- org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
- org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
- osgi.extender; filter:="(osgi.extender=pax.cdi)"
-
-
- org.switchyard,org.switchyard.*
-
- 1.3.168
- 1.3.1
- 2.4.0
- 1.0.2.Final
-
-
-
-
- org.switchyard
- switchyard-bom
- ${project.version}
- import
- pom
-
-
-
-
-
- org.switchyard
- switchyard-api
-
-
- org.switchyard.components
- switchyard-component-camel-sql
-
-
- org.switchyard.components
- switchyard-component-camel-quartz
-
-
- org.switchyard.components
- switchyard-component-bean
-
-
- org.switchyard
- switchyard-test
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-cdi
- test
-
-
- org.switchyard.components
- switchyard-component-test-mixin-naming
- test
-
-
- com.h2database
- h2
- test
-
-
- org.hamcrest
- hamcrest-core
- test
-
-
-
- ${project.artifactId}
-
-
- org.switchyard
- switchyard-plugin
- ${project.version}
-
-
-
- configure
-
-
-
- org.switchyard.transform.config.model.TransformSwitchYardScanner
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${version.felix.maven}
- true
-
- false
-
- ${bundle.symbolic.name}
- ${switchyard.osgi.dynamic}
- !*
- ${switchyard.osgi.import}
- {maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml
- ${switchyard.osgi.require.capability}
-
-
-
- ${project.artifactId}
- ${project.groupId}
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${version.enforcer.maven}
-
-
- enforce-versions
-
- enforce
-
- clean
-
-
-
- 1.7
-
-
-
-
-
-
-
- org.wildfly.plugins
- wildfly-maven-plugin
- ${version.wildfly.maven}
-
-
- deploy
- install
-
- deploy-only
-
-
-
-
-
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
- undeploy
- clean
-
- undeploy
-
-
-
-
-
-
-
- ${project.build.finalName}.jar
- ${deploy.skip}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.1
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
-
-
- deploy
-
- false
-
-
-
- db
-
-
-
- com.edugility
- h2-maven-plugin
- 1.0
- false
-
- ${project.build.directory}
-
-
-
- Spawn a new H2 TCP server
- package
-
- spawn
-
-
-
- Stop a spawned H2 TCP server
- pre-clean
-
- stop
-
-
-
-
-
- org.codehaus.mojo
- sql-maven-plugin
- 1.5
-
-
- com.h2database
- h2
- ${version.com.h2database}
-
-
-
- org.h2.Driver
- jdbc:h2:tcp://localhost/h2db
- sa
-
-
-
- create
- package
-
- execute
-
-
- CREATE TABLE IF NOT EXISTS greetings ( id INT PRIMARY KEY AUTO_INCREMENT, receiver VARCHAR(255), sender VARCHAR(255) )
-
-
-
-
-
-
-
-
- wildfly
-
- 9990
-
-
-
- bundle
-
diff --git a/components/.gitignore b/components/.gitignore
new file mode 100644
index 000000000..9cc08abad
--- /dev/null
+++ b/components/.gitignore
@@ -0,0 +1,17 @@
+.project
+.classpath
+.settings/
+.bpmn/
+target/
+bin/
+.checkstyle
+*.iml
+*.ipr
+*.iws
+.DS_Store
+jca/transaction.log
+transaction.log.*
+itests/transaction.log
+.idea
+.fbExcludeFilterFile
+.factorypath
diff --git a/components/README b/components/README
new file mode 100644
index 000000000..4f035e59e
--- /dev/null
+++ b/components/README
@@ -0,0 +1 @@
+Repository for components which can be used with SwitchYard core.
diff --git a/components/bean/pom.xml b/components/bean/pom.xml
new file mode 100644
index 000000000..0b4af0daa
--- /dev/null
+++ b/components/bean/pom.xml
@@ -0,0 +1,93 @@
+
+
+
+ 4.0.0
+
+ org.switchyard.components
+ switchyard-components-parent
+ 2.1.0-SNAPSHOT
+ ../pom.xml
+
+ switchyard-component-bean
+ bundle
+ SwitchYard: Bean Component
+ http://switchyard.org
+
+
+ org.switchyard.component.bean.*
+
+
+ org.switchyard.*;${switchyard.osgi.import.switchyard.version},
+ org.switchyard.config.model;${switchyard.osgi.import.switchyard.version},
+ *
+
+
+ org.ops4j.pax.cdi.extension; extension=switchyard-component-bean; version:Version=${switchyard.osgi.version}
+
+
+ osgi.extender; filter:="(osgi.extender=pax.cdi)"
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+
+
+ false
+
+ ${*}
+
+
+
+
+
+
+
+ org.jboss.weld.se
+ weld-se-core
+
+
+ org.switchyard
+ switchyard-api
+
+
+ org.switchyard
+ switchyard-common
+
+
+ org.switchyard
+ switchyard-common-cdi
+
+
+ org.switchyard
+ switchyard-extensions-java
+
+
+ org.switchyard
+ switchyard-transform
+
+
+ org.switchyard.components
+ switchyard-component-common
+
+
+ org.switchyard.components
+ switchyard-component-test-mixin-cdi
+ test
+
+
+
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/BeanComponentException.java b/components/bean/src/main/java/org/switchyard/component/bean/BeanComponentException.java
new file mode 100644
index 000000000..ead976399
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/BeanComponentException.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean;
+
+import org.switchyard.Exchange;
+import org.switchyard.HandlerException;
+
+/**
+ * Bean Component Exception.
+ *
+ * @author tom.fennelly@gmail.com
+ */
+public class BeanComponentException extends HandlerException {
+
+ /**
+ * Fault exchange instance associated with the exception.
+ */
+ private Exchange _faultExchange;
+
+ /**
+ * Public constructor.
+ * @param message Exception message.
+ */
+ public BeanComponentException(final String message) {
+ super(message);
+ }
+
+ /**
+ * Create a new BeanComponentException with the specified cause.
+ * @param cause underlying error
+ */
+ public BeanComponentException(final Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Public constructor.
+ * @param message Exception message.
+ * @param cause The parent/cause exception.
+ */
+ public BeanComponentException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Set the fault {@link Exchange} instance on the exception.
+ * @param faultExchange The fault exchange instance.
+ * @return {@code this} exception instance.
+ */
+ public BeanComponentException setFaultExchange(Exchange faultExchange) {
+ this._faultExchange = faultExchange;
+ return this;
+ }
+
+ /**
+ * Get the fault {@link Exchange} instance associated with this exception instance.
+ * @return The fault exchange instance.
+ */
+ public Exchange getFaultExchange() {
+ return _faultExchange;
+ }
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/BeanLogger.java b/components/bean/src/main/java/org/switchyard/component/bean/BeanLogger.java
new file mode 100644
index 000000000..02d6ef7b1
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/BeanLogger.java
@@ -0,0 +1,33 @@
+package org.switchyard.component.bean;
+
+import org.jboss.logging.Logger;
+import org.jboss.logging.Logger.Level;
+import org.jboss.logging.annotations.LogMessage;
+import org.jboss.logging.annotations.Message;
+import org.jboss.logging.annotations.MessageLogger;
+/**
+ *
+ * This file is using the subset 30000-30399 for logger messages.
+ *
+ *
+ */
+@MessageLogger(projectCode = "SWITCHYARD")
+public interface BeanLogger {
+ /**
+ * A root logger with the category of the package name.
+ */
+ BeanLogger ROOT_LOGGER = Logger.getMessageLogger(BeanLogger.class, BeanLogger.class.getPackage().getName());
+
+ /**
+ * propertyHasIncompatibleTypeBean method definition.
+ * @param propAnnoName propAnnoName
+ * @param serviceMetadataClassName the serviceMetadataClassName
+ * @param fieldTypeName the fieldTypeName
+ * @param propertyClassName the propertyClassName
+ */
+ @LogMessage(level = Level.WARN)
+ @Message(id = 30000, value = "Property '%s' has incompatible type: Bean '%s' is expecting '%s', but was '%s'. ignoring...")
+ void propertyHasIncompatibleTypeBean(String propAnnoName, String serviceMetadataClassName, String fieldTypeName, String propertyClassName);
+
+}
+
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/BeanMessages.java b/components/bean/src/main/java/org/switchyard/component/bean/BeanMessages.java
new file mode 100644
index 000000000..63256f587
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/BeanMessages.java
@@ -0,0 +1,248 @@
+package org.switchyard.component.bean;
+
+import java.io.IOException;
+
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Cause;
+import org.jboss.logging.Messages;
+import org.jboss.logging.annotations.Message;
+import org.jboss.logging.annotations.MessageBundle;
+import org.switchyard.SwitchYardException;
+
+/**
+ *
+ * This file is using the subset 30400-30799 for logger messages.
+ *
+ *
+ */
+@MessageBundle(projectCode = "SWITCHYARD")
+public interface BeanMessages {
+ /**
+ * The default messages.
+ */
+ BeanMessages MESSAGES = Messages.getBundle(BeanMessages.class);
+
+ /**
+ * operationNameMustResolveToExactlyOneBeanMethodOnBeanType method definition.
+ * @param operationName the operationName
+ * @param serviceClassName serviceClassName
+ * @return BeanComponentException
+ */
+ @Message(id = 30400, value = "Operation name '%s' must resolve to exactly one bean method on bean type '%s'.")
+ BeanComponentException operationNameMustResolveToExactlyOneBeanMethodOnBeanType(String operationName, String serviceClassName);
+
+ /**
+ * operationNameNotSpecifiedOnExchange method definition.
+ * @return BeanComponentException
+ */
+ @Message(id = 30401, value = "Operation name not specified on exchange.")
+ BeanComponentException operationNameNotSpecifiedOnExchange();
+
+ /**
+ * aServiceReferenceToServiceIsNotBoundInto method definition.
+ * @param serviceName the serviceName
+ * @return BeanComponentException
+ */
+ @Message(id = 30402, value = "A service reference to service '%s' is not bound into this client proxy instance. A reference configuration to the service may be required in the application configuration.")
+ BeanComponentException aServiceReferenceToServiceIsNotBoundInto(String serviceName);
+
+ /**
+ * beanComponentInvocationFailureServiceOperation method definition.
+ * @param serviceName serviceName
+ * @param methodName methodName
+ * @return BeanComponentException
+ */
+ @Message(id = 30403, value = "Bean Component invocation failure. Service '%s', operation '%s'.")
+ BeanComponentException beanComponentInvocationFailureServiceOperation(String serviceName, String methodName);
+
+ /**
+ * beanComponentInvocationFailureOperationIsNotDefinedOnService method definition.
+ * @param operationName the operationName
+ * @param serviceName serviceName
+ * @return BeanComponentException
+ */
+ @Message(id = 30404, value = "Bean Component invocation failure. Operation '%s' is not defined on Service '%s'.")
+ BeanComponentException beanComponentInvocationFailureOperationIsNotDefinedOnService(String operationName, String serviceName);
+
+ /**
+ * unknownPolicy method definition.
+ * @param secPolicy the secPolicy
+ * @return IOException
+ */
+ @Message(id = 30405, value = "Unknown policy: %s")
+ IOException unknownPolicy(String secPolicy);
+
+ /**
+ * null method definition.
+ * @param ptx the ptx
+ * @param stx the stx
+ * @param name the name
+ * @return IOException
+ */
+ @Message(id = 30407, value = "TransactionPolicies %s and %s cannot co-exist on service %s")
+ IOException transactionPoliciesCannotCoexistService(QName ptx, QName stx, String name);
+
+ /**
+ * null method definition.
+ * @param gtx the gtx
+ * @param ltx the ltx
+ * @param ntx the ntx
+ * @param name the name
+ * @return IOException
+ */
+ @Message(id = 30408, value = "TransactionPolicies %s, %s and %s cannot co-exist on implementation %s")
+ IOException transactionPoliciesCannotCoexistImplementation(QName gtx, QName ltx, QName ntx, String name);
+
+ /**
+ * stringFormatReferenceOnlyCouldBeMarkedWithInteractionPolicyBut%sIsNotTheOne method definition.
+ * @param policy policy
+ * @return IOException
+ */
+ @Message(id = 30409, value = "Reference only could be marked with Interaction policy, but %s is not the one.")
+ IOException referenceOnlyCouldBeMarkedWithInteractionPolicyButIsNotTheOne(String policy);
+
+ /**
+ * unknownServiceName method definition.
+ * @param serviceName the serviceName
+ * @return SwitchYardException
+ */
+ @Message(id = 30412, value = "Unknown Service name '%s'.")
+ SwitchYardException unknownServiceName(String serviceName);
+
+ /**
+ * failedToLookupBeanDeploymentMetaDataFromBeanManagerMustBeBoundIntoBeanManagerPerhapsSwitchYardCDIExtensionsNotProperlyInstalledInContainer method definition.
+ * @return SwitchYardException
+ */
+ @Message(id = 30414, value = "Failed to lookup BeanDeploymentMetaData from BeanManager. Must be bound into BeanManager. Perhaps SwitchYard CDI Extensions not properly installed in container.")
+ SwitchYardException failedToLookupBeanDeploymentMetaDataFromBeanManagerMustBeBoundIntoBeanManagerPerhapsSwitchYardCDIExtensionsNotProperlyInstalledInContainer();
+
+ /**
+ * failedToLookupBeanDeploymentMetaDataFromBeanManagerMultipleBeansResolvedForType method definition.
+ * @param className className
+ * @return SwitchYardException
+ */
+ @Message(id = 30415, value = "Failed to lookup BeanDeploymentMetaData from BeanManager. Multiple beans resolved for type '%s'.")
+ SwitchYardException failedToLookupBeanDeploymentMetaDataFromBeanManagerMultipleBeansResolvedForType(String className);
+
+ /**
+ * failedToLookupBeanManagerMustBeBoundIntoJavaCompAsPerCDISpecification method definition.
+ * @return SwitchYardException
+ */
+ @Message(id = 30416, value = "Failed to lookup BeanManager. Must be bound into java:comp as per CDI specification.")
+ SwitchYardException failedToLookupBeanManagerMustBeBoundIntoJavaCompAsPerCDISpecification();
+
+ /**
+ * nameBeanManagerIsNotBoundInThisContext method definition.
+ * @return NameNotFoundException
+ */
+ @Message(id = 30417, value = "Name BeanManager is not bound in this Context")
+ NameNotFoundException nameBeanManagerIsNotBoundInThisContext();
+
+ /**
+ * unexpectedExceptionRetrieving method definition.
+ * @param jndiName the jndiName
+ * @param e the e
+ * @return SwitchYardException
+ */
+ @Message(id = 30418, value = "Unexpected Exception retrieving '%s' from JNDI namespace.")
+ SwitchYardException unexpectedExceptionRetrieving(String jndiName, @Cause Exception e);
+
+ /**
+ * unexpectedErrorClosingInitialContext method definition.
+ * @param e the e
+ * @return SwitchYardException
+ */
+ @Message(id = 30419, value = "Unexpected error closing InitialContext.")
+ SwitchYardException unexpectedErrorClosingInitialContext(@Cause NamingException e);
+
+ /**
+ * unexpectedExceptionThe@ServiceAnnotationRequiresAServiceInterfaceClassValueToBeDefinedYetTheAnnotationHasNoValue method definition.
+ * @return SwitchYardException
+ */
+ @Message(id = 30420, value = "Unexpected exception. The @Service annotation has no value. It cannot be ommitted unless the bean implements exactly one interface.")
+ SwitchYardException unexpectedExceptionTheServiceAnnotationHasNoValueItCannotBeOmmittedUnlessTheBeanImplementsExactlyOneInterface();
+
+ /**
+ * invalid@ServiceSpecification@Service method definition.
+ * @param serviceInterfaceName serviceInterfaceName
+ * @return SwitchYardException
+ */
+ @Message(id = 30421, value = "Invalid @Service specification @Service(%s.class). @Service interface Class must be a Java Interface. Cannot be a concrete implementation.")
+ SwitchYardException invalidServiceSpecificationService(String serviceInterfaceName);
+
+ /**
+ * illegalCallToGetTheSwitchYardContext;MustBeCalledWithinTheExecutionOfAnExchangeHandlerChain method definition.
+ * @return IllegalStateException
+ */
+ @Message(id = 30422, value = "Illegal call to get the SwitchYard Context; must be called within the execution of an ExchangeHandler chain.")
+ IllegalStateException illegalCallToGetTheSwitchYardContextMustBeCalledWithinTheExecutionOfAnExchangeHandlerChain();
+
+ /**
+ * failedToLookupBeanDeploymentMetaDataFromNamingContext method definition.
+ * @return SwitchYardException
+ */
+ @Message(id = 30424, value = "Failed to lookup BeanDeploymentMetaData from Naming Context.")
+ SwitchYardException failedToLookupBeanDeploymentMetaDataFromNamingContext();
+
+ /**
+ * beanServiceOperation method definition.
+ * @param operationName operationName
+ * @return BeanComponentException
+ */
+ @Message(id = 30425, value = "Bean service operation '%s' has more than 1 argument. Bean component currently only supports single argument operations.")
+ BeanComponentException beanServiceOperationMoreThanOne(String operationName);
+
+ /**
+ * beanServiceOperation method definition.
+ * @param operationName operationName
+ * @return BeanComponentException
+ */
+ @Message(id = 30426, value = "Bean service operation '%s' requires a single argument. Exchange payload specifies no payload.")
+ BeanComponentException beanServiceOperationRequiresSingle(String operationName);
+
+ /**
+ * beanServiceOperation method definition.
+ * @param operationName operationName
+ * @param argsLength argsLength
+ * @return BeanComponentException
+ */
+ @Message(id = 30427, value = "Bean service operation '%s' only supports a single argument. Exchange payload specifies %s args.")
+ BeanComponentException beanServiceOperationSupportsSingle(String operationName, String argsLength);
+
+ /**
+ * beanServiceOperationRequiresAPayloadTypeOf method definition.
+ * @param operationName operationName
+ * @param argTypeName argTypeName
+ * @param className className
+ * @return BeanComponentException
+ */
+ @Message(id = 30428, value = "Bean service operation '%s' requires a payload type of '%s'. Actual payload type is '%s'. You must define and register a Transformer.")
+ BeanComponentException beanServiceOperationRequiresAPayloadTypeOf(String operationName, String argTypeName, String className);
+
+ /**
+ * unexpectedErrorBeanServiceMetadataShouldReturnAnInvocationInstanceOrThrowABeanComponentException method definition.
+ * @return SwitchYardException
+ */
+ @Message(id = 30430, value = "Unexpected error. BeanServiceMetadata should return an Invocation instance, or throw a BeanComponentException.")
+ SwitchYardException unexpectedErrorBeanServiceMetadataShouldReturnAnInvocationInstanceOrThrowABeanComponentException();
+
+ /**
+ * invocationOfOperationFailed method definition.
+ * @param invocationMethodName invocationMethodName
+ * @param serviceBeanClassName serviceBeanClassName
+ * @return String
+ */
+ @Message(id = 30431, value = "Invocation of operation '%s' on bean component '%s' failed.")
+ String invocationOfOperationFailed(String invocationMethodName, String serviceBeanClassName);
+
+ /**
+ * illegalExchangeAccessOutsideHandlerChain method definition.
+ * @return String
+ */
+ @Message(id = 30432, value = "Illegal call to get the SwitchYard Exchange; must be called within the execution of an ExchangeHandler chain.")
+ IllegalStateException illegalExchangeAccessOutsideHandlerChain();
+
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/BeanServiceMetadata.java b/components/bean/src/main/java/org/switchyard/component/bean/BeanServiceMetadata.java
new file mode 100644
index 000000000..24ea52cac
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/BeanServiceMetadata.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean;
+
+import org.switchyard.Exchange;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Bean Service meta data.
+ *
+ * Provides access to Bean Service operation invocation information.
+ *
+ * @author tom.fennelly@gmail.com
+ */
+public class BeanServiceMetadata {
+
+ /**
+ * Service bean component runtime class.
+ */
+ private Class extends Object> _serviceClass;
+ /**
+ * List of service methods/operations.
+ */
+ private List _serviceMethods = new ArrayList();
+
+ /**
+ * Public constructor.
+ *
+ * @param serviceClass The service bean class.
+ */
+ public BeanServiceMetadata(Class extends Object> serviceClass) {
+ Method[] serviceMethods = serviceClass.getMethods();
+ for (Method serviceMethod : serviceMethods) {
+ if (serviceMethod.getDeclaringClass() != Object.class) {
+ this._serviceMethods.add(serviceMethod);
+ }
+ }
+ this._serviceClass = serviceClass;
+ }
+
+ /**
+ * Get the Service Interface runtime class.
+ * @return The Service Interface runtime class.
+ */
+ public Class extends Object> getServiceClass() {
+ return _serviceClass;
+ }
+
+ /**
+ * Get the Bean Service operation {@link Invocation} for the specified
+ * {@link Exchange}.
+ *
+ * @param exchange The Exchange instance.
+ * @return The operation {@link Invocation} instance.
+ * @throws BeanComponentException Error invoking Bean component operation.
+ */
+ public Invocation getInvocation(Exchange exchange) throws BeanComponentException {
+
+ String operationName = exchange.getContract().getProviderOperation().getName();
+
+ if (operationName != null) {
+ List candidateMethods = getCandidateMethods(operationName);
+
+ // Operation name must resolve to exactly one bean method...
+ if (candidateMethods.size() != 1) {
+ throw BeanMessages.MESSAGES.operationNameMustResolveToExactlyOneBeanMethodOnBeanType(operationName, _serviceClass.getName());
+ }
+
+ Method operationMethod = candidateMethods.get(0);
+ return new Invocation(operationMethod, exchange);
+ } else {
+ throw BeanMessages.MESSAGES.operationNameNotSpecifiedOnExchange();
+ }
+ }
+
+ /**
+ * Get the list of candidate service {@link Method methods/operations} for the specified
+ * operation name.
+ *
+ * @param operationName The operation name.
+ * @return The list of possible matching operation methods.
+ */
+ public List getCandidateMethods(String operationName) {
+ List candidateMethods = new ArrayList();
+
+ for (Method serviceMethod : _serviceMethods) {
+ if (serviceMethod.getName().equals(operationName)) {
+ candidateMethods.add(serviceMethod);
+ }
+ }
+
+ return candidateMethods;
+ }
+
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/ClientProxyBean.java b/components/bean/src/main/java/org/switchyard/component/bean/ClientProxyBean.java
new file mode 100644
index 000000000..41225cbe5
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/ClientProxyBean.java
@@ -0,0 +1,351 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.Type;
+import java.text.MessageFormat;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.util.AnnotationLiteral;
+
+import org.switchyard.Exchange;
+import org.switchyard.ExchangeHandler;
+import org.switchyard.ExchangeState;
+import org.switchyard.ServiceReference;
+import org.switchyard.component.bean.deploy.BeanDeploymentMetaData;
+import org.switchyard.component.common.SynchronousInOutHandler;
+import org.switchyard.extensions.java.JavaService;
+
+/**
+ * Client Proxy CDI Bean.
+ *
+ * CDI bean for injecting into consumer beans where the {@link org.switchyard.component.bean.Reference @Reference}
+ * is used.
+ *
+ * @author tom.fennelly@gmail.com
+ */
+public class ClientProxyBean implements Bean {
+
+ /**
+ * The target Service.
+ */
+ private String _serviceName;
+
+ /**
+ * Target service reference.
+ */
+ private ServiceReference _service;
+
+ /**
+ * The bean proxy Interface {@link Class} of the bean being proxied. This class
+ * must be one of the {@link org.switchyard.component.bean.Service @Service}
+ * interfaces implemented by the actual Service bean component.
+ */
+ private Class> _serviceInterface;
+
+ /**
+ * CDI bean qualifiers. See CDI Specification.
+ */
+ private Set _qualifiers;
+
+ /**
+ * The dynamic proxy bean instance created from the supplied {@link #_serviceInterface}.
+ */
+ private Object _proxyBean;
+
+ /**
+ * Public constructor.
+ *
+ * @param serviceName The name of the ESB Service being proxied to.
+ * @param proxyInterface The proxy Interface.
+ * @param qualifiers The CDI bean qualifiers. Copied from the injection point.
+ * @param beanDeploymentMetaData Deployment metadata.
+ */
+ public ClientProxyBean(String serviceName, Class> proxyInterface, Set qualifiers, BeanDeploymentMetaData beanDeploymentMetaData) {
+ this._serviceName = serviceName;
+ this._serviceInterface = proxyInterface;
+
+ if (qualifiers != null) {
+ this._qualifiers = qualifiers;
+ } else {
+ this._qualifiers = new HashSet();
+ this._qualifiers.add(new AnnotationLiteral() {
+ });
+ this._qualifiers.add(new AnnotationLiteral() {
+ });
+ }
+
+ _proxyBean = Proxy.newProxyInstance(beanDeploymentMetaData.getDeploymentClassLoader(),
+ new Class[]{_serviceInterface},
+ new ClientProxyInvocationHandler(_serviceInterface));
+ }
+
+ /**
+ * Get the name of the ESB Service being proxied to.
+ *
+ * @return The Service name.
+ */
+ public String getServiceName() {
+ return _serviceName;
+ }
+
+ /**
+ * Get the Service interface.
+ * @return The service interface.
+ */
+ public Class> getServiceInterface() {
+ return _serviceInterface;
+ }
+
+ /**
+ * Set the service reference for the target Service.
+ * @param service The target service.
+ */
+ public void setService(ServiceReference service) {
+ this._service = service;
+ }
+
+ /**
+ * Obtains the {@linkplain javax.enterprise.inject bean types} of the bean.
+ *
+ * @return the {@linkplain javax.enterprise.inject bean types}
+ */
+ public Set getTypes() {
+ Set types = new HashSet();
+ types.add(_serviceInterface);
+ types.add(Object.class);
+ return types;
+ }
+
+ /**
+ * Obtains the {@linkplain javax.inject.Qualifier qualifiers} of the bean.
+ *
+ * @return the {@linkplain javax.inject.Qualifier qualifiers}
+ */
+ public Set getQualifiers() {
+ return _qualifiers;
+ }
+
+ /**
+ * Obtains the {@linkplain javax.enterprise.inject EL name} of a bean, if it has one.
+ *
+ * @return the {@linkplain javax.enterprise.inject EL name}
+ */
+ public String getName() {
+ return null;
+ }
+
+ /**
+ * Obtains the {@linkplain javax.enterprise.inject.Stereotype stereotypes}
+ * of the bean.
+ *
+ * @return the set of {@linkplain javax.enterprise.inject.Stereotype stereotypes}
+ */
+ public Set> getStereotypes() {
+ return Collections.emptySet();
+ }
+
+ /**
+ * The bean {@linkplain Class class} of the managed bean or session bean or
+ * of the bean that declares the producer method or field.
+ *
+ * @return the bean {@linkplain Class class}
+ */
+ public Class> getBeanClass() {
+ return _serviceInterface;
+ }
+
+ /**
+ * Determines if the bean is an
+ * {@linkplain javax.enterprise.inject.Alternative alternative}.
+ *
+ * @return true if the bean is an
+ * {@linkplain javax.enterprise.inject.Alternative alternative},
+ * and false otherwise.
+ */
+ public boolean isAlternative() {
+ return false;
+ }
+
+ /**
+ * Determines if
+ * {@link javax.enterprise.context.spi.Contextual#create(CreationalContext)}
+ * sometimes return a null value.
+ *
+ * @return true if the {@code create()} method may return a null
+ * value, and false otherwise
+ */
+ public boolean isNullable() {
+ return false;
+ }
+
+ /**
+ * Obtains the {@link javax.enterprise.inject.spi.InjectionPoint} objects
+ * representing injection points of the bean, that will be validated by the
+ * container at initialization time.
+ *
+ * @return the set of {@linkplain javax.enterprise.inject.spi.InjectionPoint injection points} of the bean
+ */
+ public Set getInjectionPoints() {
+ return Collections.emptySet();
+ }
+
+ /**
+ * Obtains the {@linkplain javax.enterprise.context scope} of the bean.
+ *
+ * @return the {@linkplain javax.enterprise.context scope}
+ */
+ public Class extends Annotation> getScope() {
+ return ApplicationScoped.class;
+ }
+
+ /**
+ * Create a new instance of the contextual type. Instances should
+ * use the given {@link javax.enterprise.context.spi.CreationalContext}
+ * when obtaining contextual references to inject, in order to ensure
+ * that any dependent objects are associated with the contextual instance
+ * that is being created. An implementation may call
+ * {@link javax.enterprise.context.spi.CreationalContext#push(Object)}
+ * between instantiation and injection to help the container minimize the
+ * use of client proxy objects.
+ *
+ * @param creationalContext the context in which this instance is being created
+ * @return the contextual instance
+ */
+ public Object create(CreationalContext creationalContext) {
+ return _proxyBean;
+ }
+
+ /**
+ * Destroy an instance of the contextual type. Implementations should
+ * call {@link javax.enterprise.context.spi.CreationalContext#release()}
+ * to allow the container to destroy dependent objects of the contextual
+ * instance.
+ *
+ * @param instance the contextual instance to destroy
+ * @param creationalContext the context in which this instance was created
+ */
+ public void destroy(Object instance, CreationalContext creationalContext) {
+
+ }
+
+ /**
+ * Dynamic proxy {@link InvocationHandler}.
+ */
+ private class ClientProxyInvocationHandler implements InvocationHandler {
+
+ private JavaService _invokerInterface;
+
+ public ClientProxyInvocationHandler(Class> invokerInterface) {
+ _invokerInterface = JavaService.fromClass(invokerInterface);
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ if (_service == null) {
+ throw BeanMessages.MESSAGES.aServiceReferenceToServiceIsNotBoundInto(_serviceName);
+ }
+
+ // Handle basic Object methods.
+ if (method.getDeclaringClass() == Object.class) {
+ final String methodName = method.getName();
+ final int paramCount = method.getParameterTypes().length;
+ if ("toString".equals(methodName) && paramCount == 0) {
+ return MessageFormat.format("SwitchYard proxy for {0} [{1}]", _invokerInterface.getJavaInterface(), _invokerInterface);
+ } else if ("equals".equals(methodName) && paramCount == 1) {
+ return this.equals(args[0]);
+ } else if ("hashCode".equals(methodName) && paramCount == 0) {
+ return this.hashCode();
+ }
+ }
+
+ if (method.getReturnType() != null && !Void.TYPE.isAssignableFrom(method.getReturnType())) {
+ SynchronousInOutHandler inOutHandler = new SynchronousInOutHandler();
+
+ Exchange exchangeIn = createExchange(_service, method, inOutHandler);
+ // Don't set the message content as an array unless there are multiple arguments
+ if (args != null && args.length == 1) {
+ exchangeIn.send(exchangeIn.createMessage().setContent(args[0]));
+ } else {
+ exchangeIn.send(exchangeIn.createMessage().setContent(args));
+ }
+
+ Exchange exchangeOut = inOutHandler.waitForOut();
+ if (exchangeOut.getState() == ExchangeState.OK) {
+ return exchangeOut.getMessage().getContent(method.getReturnType());
+ } else {
+ return handleException(exchangeOut, method);
+ }
+ } else {
+ Exchange exchange = createExchange(_service, method, null);
+ // Don't set the message content as an array unless there are multiple arguments
+ if (args == null) {
+ exchange.send(exchange.createMessage());
+ } else if (args.length == 1) {
+ exchange.send(exchange.createMessage().setContent(args[0]));
+ } else {
+ exchange.send(exchange.createMessage().setContent(args));
+ }
+
+ Object propagateException = _service.getDomain().getProperty(Exchange.PROPAGATE_EXCEPTION_ON_IN_ONLY);
+ if ((propagateException == null || Boolean.parseBoolean(propagateException.toString()))
+ && exchange.getState().equals(ExchangeState.FAULT)) {
+ handleException(exchange, method);
+ }
+ return null;
+ }
+ }
+
+ private Exchange createExchange(ServiceReference service, Method method, ExchangeHandler responseExchangeHandler) throws BeanComponentException {
+ String operationName = method.getName();
+ if (service.getInterface().getOperation(operationName) == null) {
+ throw BeanMessages.MESSAGES.beanComponentInvocationFailureOperationIsNotDefinedOnService(operationName, _serviceName);
+ }
+
+ return service.createExchange(operationName, responseExchangeHandler);
+ }
+
+ private Throwable handleException(Exchange exchange, Method method) throws Throwable {
+ Object exceptionObj = exchange.getMessage().getContent();
+ if (exceptionObj instanceof Throwable) {
+ if (exceptionObj instanceof BeanComponentException) {
+ BeanComponentException beanCompException = (BeanComponentException) exceptionObj;
+ Throwable cause = beanCompException.getCause();
+ if (cause instanceof InvocationTargetException) {
+ throw cause.getCause();
+ } else {
+ throw cause;
+ }
+ }
+ throw (Throwable) exceptionObj;
+ } else {
+ throw BeanMessages.MESSAGES.beanComponentInvocationFailureServiceOperation(_serviceName, method.getName()).setFaultExchange(exchange);
+ }
+ }
+
+ }
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/Invocation.java b/components/bean/src/main/java/org/switchyard/component/bean/Invocation.java
new file mode 100644
index 000000000..faeaa739d
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/Invocation.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean;
+
+import org.switchyard.Exchange;
+import org.switchyard.Message;
+
+import java.lang.reflect.Method;
+
+/**
+ * Bean component invocation details.
+ *
+ * @author tom.fennelly@gmail.com
+ */
+public class Invocation {
+
+ /**
+ * The method/operation being invoked.
+ */
+ private Method _method;
+ /**
+ * The exchange instance.
+ */
+ private Exchange _exchange;
+
+ /**
+ * The invocation arguments.
+ */
+ private Object[] _args;
+
+ /**
+ * Constructor.
+ *
+ * @param method The method/operation being invoked.
+ * @param exchange The exchange instance.
+ * @throws BeanComponentException Unsupported method structure, or type mismatch.
+ */
+ Invocation(Method method, Exchange exchange) throws BeanComponentException {
+ this._method = method;
+ this._exchange = exchange;
+ this._args = castArg(method, exchange.getMessage());
+ assertOK();
+ }
+
+ /**
+ * Assert that the exchange payload type(s) and the bean method
+ * argument type(s) match.
+ */
+ private void assertOK() throws BeanComponentException {
+ assertMethodStructureSupported();
+ assertTypesMatch();
+ }
+
+ /**
+ * Get the invocation arguments.
+ *
+ * @return The invocation arguments.
+ */
+ public Object[] getArgs() {
+ return _args;
+ }
+
+ /**
+ * Get the method/operation being invoked.
+ *
+ * @return The method/operation being invoked.
+ */
+ public Method getMethod() {
+ return _method;
+ }
+
+ private static Object[] castArg(Method method, Message message) {
+ if (method.getParameterTypes().length == 1 && message != null) {
+ return new Object[]{message.getContent(method.getParameterTypes()[0])};
+ }
+ return null;
+ }
+
+ private void assertMethodStructureSupported() throws BeanComponentException {
+ Class>[] parameterTypes = _method.getParameterTypes();
+
+ // TODO: Only supports 0 or 1 arg operations for now...
+ if (parameterTypes.length > 1) {
+ throw BeanMessages.MESSAGES.beanServiceOperationMoreThanOne(operationName());
+ }
+ }
+
+ private void assertTypesMatch() throws BeanComponentException {
+ if (_args == null) {
+ if (_method.getParameterTypes().length != 0) {
+ throw BeanMessages.MESSAGES.beanServiceOperationRequiresSingle(operationName());
+ }
+ } else {
+ if (_args.length > 1) {
+ throw BeanMessages.MESSAGES.beanServiceOperationSupportsSingle(operationName(), Integer.toString(_args.length));
+ }
+
+ if (_args[0] != null) {
+ Class> argType = _method.getParameterTypes()[0];
+
+ if (!argType.isInstance(_args[0])) {
+ throw BeanMessages.MESSAGES.beanServiceOperationRequiresAPayloadTypeOf(operationName(), argType.getName(), _args[0].getClass().getName());
+ }
+ }
+ }
+ }
+
+ private String operationName() {
+ return _exchange.getProvider().getName() + "#" + _method.getName();
+ }
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/Property.java b/components/bean/src/main/java/org/switchyard/component/bean/Property.java
new file mode 100644
index 000000000..03337b94d
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/Property.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Property Annotation.
+ * Use this annotation to inject a Property into service bean component.
+ */
+@Target(FIELD)
+@Retention(RUNTIME)
+@Documented
+public @interface Property {
+
+ /**
+ * name of the property.
+ */
+ String name() default "";
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/Reference.java b/components/bean/src/main/java/org/switchyard/component/bean/Reference.java
new file mode 100644
index 000000000..19f5ee61f
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/Reference.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Service reference.
+ *
+ * Use this annotation, in conjunction with the {@link javax.inject.Inject}
+ * annotation, to inject a reference to a Service bean component.
+ *
+ * @author tom.fennelly@gmail.com
+ */
+@Qualifier
+@Target({TYPE, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface Reference {
+
+ /**
+ * Get the name of the Service to which a reference
+ * is to be injected.
+ */
+ String value() default "";
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/ReferenceInvocation.java b/components/bean/src/main/java/org/switchyard/component/bean/ReferenceInvocation.java
new file mode 100644
index 000000000..7cb9349d8
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/ReferenceInvocation.java
@@ -0,0 +1,58 @@
+package org.switchyard.component.bean;
+
+import org.switchyard.Context;
+import org.switchyard.Message;
+
+/**
+ * An instance of an invocation for an @Reference. A single instance of
+ * ReferenceInvocation cannot be used for multiple invocations of a service.
+ * Message content and context properties for an invocation can be accessed
+ * through this interface.
+ */
+public interface ReferenceInvocation {
+
+ /**
+ * Access the context for a reference.
+ * @return context
+ */
+ Context getContext();
+
+ /**
+ * Access the current message for a reference. Before invoke() is called
+ * this will return the IN message. After invoke() is called, this will
+ * return the OUT message for IN_OUT MEPs.
+ * @return current message.
+ */
+ Message getMessage();
+
+ /**
+ * Invoke the target service.
+ * @return a reference to this ReferenceInvocation for chaining calls
+ * @throws Exception fault encountered during the invocation
+ */
+ ReferenceInvocation invoke() throws Exception;
+
+ /**
+ * Invoke the target service using the specified object as the message content.
+ * @param content message content
+ * @return a reference to this ReferenceInvocation for chaining calls
+ * @throws Exception fault encountered during the invocation
+ */
+ ReferenceInvocation invoke(Object content) throws Exception;
+
+ /**
+ * Convenience method for setting a message-scoped context property for the
+ * invocation.
+ * @param name property name
+ * @param value property value
+ * @return a reference to this ReferenceInvocation for chaining calls
+ */
+ ReferenceInvocation setProperty(String name, String value);
+
+ /**
+ * Convenience method to retrieve a context property.
+ * @param name property name
+ * @return property value
+ */
+ Object getProperty(String name);
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/ReferenceInvoker.java b/components/bean/src/main/java/org/switchyard/component/bean/ReferenceInvoker.java
new file mode 100644
index 000000000..8d1c655ec
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/ReferenceInvoker.java
@@ -0,0 +1,34 @@
+package org.switchyard.component.bean;
+
+import org.switchyard.metadata.ServiceInterface;
+
+/**
+ * Used to create invocation instances for @Reference injection points in
+ * a bean service. A new ReferenceInvocation should be created for each
+ * invocation of the target reference.
+ *
+ * If the contract associated with the reference has
+ * multiple operations, the overloaded version of newInvocation() must be
+ * used to specify the operation name.
+ */
+public interface ReferenceInvoker {
+ /**
+ * Create a new instance of an invocation when the reference contract
+ * only has one operation.
+ * @return new instance of ReferenceInvocation
+ */
+ ReferenceInvocation newInvocation();
+
+ /**
+ * Create a new instance of an invocation for the specified operation.
+ * @param operation name of the operation to invoke
+ * @return new instance of ReferenceInvocation
+ */
+ ReferenceInvocation newInvocation(String operation);
+
+ /**
+ * Get the service contract for the reference.
+ * @return service contract used by the reference
+ */
+ ServiceInterface getContract();
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/Service.java b/components/bean/src/main/java/org/switchyard/component/bean/Service.java
new file mode 100644
index 000000000..4d1c2612e
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/Service.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Bean Service Annotation.
+ *
+ * @author tom.fennelly@gmail.com
+ * @author jpechane@redhat.com
+ * @see org.switchyard.component.bean.Reference
+ */
+@Target({TYPE, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface Service {
+
+ /**
+ * Get the Service Interface for the Service.
+ */
+ // Class field couldn't be declared so using a literal anyway
+ Class> value() default Service.class;
+
+ /**
+ * Optional Service name.
+ */
+ String name() default EMPTY;
+
+ /**
+ * Optional name of the component that implements the service.
+ */
+ String componentName() default EMPTY;
+
+ /**
+ * Constant representing a null (i.e. unassigned) value.
+ * Annotations are not allowed to have empty values, so a default
+ * representation for an empty value is used.
+ */
+ public static final String EMPTY = "";
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/ServiceProxyHandler.java b/components/bean/src/main/java/org/switchyard/component/bean/ServiceProxyHandler.java
new file mode 100644
index 000000000..5653f48c7
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/ServiceProxyHandler.java
@@ -0,0 +1,230 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.switchyard.Exchange;
+import org.switchyard.ExchangePattern;
+import org.switchyard.ExchangePhase;
+import org.switchyard.HandlerException;
+import org.switchyard.Message;
+import org.switchyard.ServiceReference;
+import org.switchyard.common.property.PropertyResolver;
+import org.switchyard.common.type.reflect.FieldAccess;
+import org.switchyard.component.bean.deploy.BeanDeploymentMetaData;
+import org.switchyard.component.bean.internal.ReferenceInvokerBean;
+import org.switchyard.component.bean.internal.context.ContextProxy;
+import org.switchyard.component.bean.internal.exchange.ExchangeProxy;
+import org.switchyard.component.bean.internal.message.MessageProxy;
+import org.switchyard.deploy.BaseServiceHandler;
+import org.switchyard.deploy.ComponentNames;
+import org.switchyard.deploy.ServiceHandler;
+
+/**
+ * Service/Provider proxy handler.
+ *
+ * Handler for converting extracting Service operation invocation details from
+ * an ESB {@link Exchange}, making the invocation and then mapping the invocation
+ * return/result onto the {@link Message Exchange Message} (if the Exchange pattern
+ * is {@link ExchangePattern#IN_OUT IN_OUT}).
+ *
+ * @author tom.fennelly@gmail.com
+ */
+public class ServiceProxyHandler extends BaseServiceHandler implements ServiceHandler {
+
+ private static Logger _logger = Logger.getLogger(ServiceProxyHandler.class);
+
+ /**
+ * The Service bean instance being proxied to.
+ */
+ private Object _serviceBean;
+ /**
+ * The Service bean metadata.
+ */
+ private BeanServiceMetadata _serviceMetadata;
+ /**
+ * Deployment metadata.
+ */
+ private BeanDeploymentMetaData _beanDeploymentMetaData;
+
+ private Map _references =
+ new HashMap();
+
+ /**
+ * Public constructor.
+ *
+ * @param serviceBean The Service bean instance being proxied to.
+ * @param serviceMetadata The Service bean metadata.
+ * @param beanDeploymentMetaData Deployment metadata.
+ */
+ public ServiceProxyHandler(Object serviceBean,
+ BeanServiceMetadata serviceMetadata,
+ BeanDeploymentMetaData beanDeploymentMetaData) {
+ _serviceBean = serviceBean;
+ _serviceMetadata = serviceMetadata;
+ _beanDeploymentMetaData = beanDeploymentMetaData;
+ }
+
+ /**
+ * Called when a message is sent through an exchange.
+ *
+ * @param exchange an {@code Exchange} instance containing a message to be processed.
+ * @throws HandlerException when handling of the message event fails (e.g. invalid request message).
+ */
+ public void handleMessage(Exchange exchange) throws HandlerException {
+ handle(exchange);
+ }
+
+ /**
+ * Called when a fault is generated while processing an exchange.
+ *
+ * @param exchange an {@code Exchange} instance containing a message to be processed.
+ */
+ public void handleFault(Exchange exchange) {
+ }
+
+ /**
+ * Add the specified reference to the handler.
+ * @param reference service reference
+ */
+ public void addReference(ServiceReference reference) {
+ QName refName = ComponentNames.unqualify(reference);
+ _references.put(refName.getLocalPart(), reference);
+ }
+
+ /**
+ * Inject Implementation Properties into Bean component.
+ * @param resolver property resolver
+ */
+ public void injectImplementationProperties(PropertyResolver resolver) {
+ for (Field field : _serviceBean.getClass().getDeclaredFields()) {
+ Property propAnno = field.getAnnotation(Property.class);
+ if (propAnno != null) {
+ String propertyName = propAnno.name();
+ if (propertyName.equals("")) {
+ propertyName = field.getName();
+ }
+ Object property = resolver.resolveProperty(propertyName);
+ if (property != null) {
+ if (field.getType().isAssignableFrom(property.getClass())) {
+ new FieldAccess(field).write(_serviceBean, property);
+ } else {
+ BeanLogger.ROOT_LOGGER.propertyHasIncompatibleTypeBean(propAnno.name(), _serviceMetadata.getServiceClass().getName(), field.getType().getName(), property.getClass().getName());
+ }
+ }
+
+ }
+ }
+ }
+
+ protected ClassLoader getDeploymentClassLoader() {
+ return _beanDeploymentMetaData.getDeploymentClassLoader();
+ }
+
+ /**
+ * Handle the Service bean invocation.
+ *
+ * @param exchange The Exchange instance.
+ * @throws HandlerException Error invoking Bean component operation.
+ */
+ private void handle(Exchange exchange) throws HandlerException {
+ Invocation invocation = _serviceMetadata.getInvocation(exchange);
+
+ if (invocation != null) {
+ ExchangePattern exchangePattern = exchange.getContract().getProviderOperation().getExchangePattern();
+ try {
+
+ if (_logger.isDebugEnabled()) {
+ _logger.debug("CDI Bean Service ExchangeHandler proxy class received " + exchangePattern + " Exchange ("
+ + System.identityHashCode(exchange) + ") for Bean Service '"
+ + exchange.getProvider().getName() + "'. Invoking bean method '" + invocation.getMethod().getName() + "'.");
+ }
+
+ Object responseObject;
+ ContextProxy.setContext(exchange.getContext());
+ MessageProxy.setMessage(exchange.getMessage());
+ ExchangeProxy.setExchange(exchange);
+ try {
+ responseObject = invocation.getMethod().invoke(_serviceBean, invocation.getArgs());
+ } finally {
+ ContextProxy.setContext(null);
+ MessageProxy.setMessage(null);
+ ExchangeProxy.setExchange(null);
+ }
+
+ if (exchangePattern == ExchangePattern.IN_OUT
+ && exchange.getPhase() != ExchangePhase.OUT) {
+ Message message = exchange.createMessage();
+ message.setContent(responseObject);
+ exchange.send(message);
+ }
+ } catch (Exception ex) {
+ String errMsg = BeanMessages.MESSAGES.invocationOfOperationFailed(invocation.getMethod().getName(),
+ _serviceBean.getClass().getName());
+ // write error details to log
+ if (_logger.isDebugEnabled()) {
+ _logger.debug(errMsg, ex);
+ }
+
+ // if the exception is declared on service interface, use sendFault, otherwise throw an exception
+ Throwable faultContent = ex;
+ if (faultContent instanceof InvocationTargetException) {
+ faultContent = ((InvocationTargetException)ex).getTargetException();
+ }
+ if (exchangePattern == ExchangePattern.IN_OUT) {
+ for (Class> expectedFault : invocation.getMethod().getExceptionTypes()) {
+ if (expectedFault.isAssignableFrom(faultContent.getClass())) {
+ exchange.sendFault(exchange.createMessage().setContent(faultContent));
+ return;
+ }
+ }
+ }
+ throw new HandlerException(faultContent);
+ }
+ } else {
+ throw BeanMessages.MESSAGES.unexpectedErrorBeanServiceMetadataShouldReturnAnInvocationInstanceOrThrowABeanComponentException();
+ }
+ }
+
+ @Override
+ protected void doStart() {
+ // Initialise any client proxies to the started service...
+ for (ClientProxyBean proxyBean : _beanDeploymentMetaData.getClientProxies()) {
+ if (_references.containsKey(proxyBean.getServiceName())) {
+ proxyBean.setService(_references.get(proxyBean.getServiceName()));
+ }
+ }
+
+ // Initialise ReferenceInvokers
+ for (ReferenceInvokerBean invokerBean : _beanDeploymentMetaData.getReferenceInvokers()) {
+ if (_references.containsKey(invokerBean.getServiceName())) {
+ invokerBean.setReference(_references.get(invokerBean.getServiceName()));
+ }
+ }
+ }
+
+ @Override
+ public void stop() {
+ // NOP
+ // leave state alone
+ }
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/SwitchYardCDIServiceDiscovery.java b/components/bean/src/main/java/org/switchyard/component/bean/SwitchYardCDIServiceDiscovery.java
new file mode 100644
index 000000000..0b2834a20
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/SwitchYardCDIServiceDiscovery.java
@@ -0,0 +1,202 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.ProcessBean;
+
+import org.jboss.logging.Logger;
+import org.switchyard.common.type.Classes;
+import org.switchyard.component.bean.deploy.BeanDeploymentMetaData;
+import org.switchyard.component.bean.deploy.BeanDeploymentMetaDataCDIBean;
+import org.switchyard.component.bean.deploy.CDIBean;
+import org.switchyard.component.bean.deploy.CDIBeanServiceDescriptor;
+import org.switchyard.component.bean.internal.ReferenceInvokerBean;
+import org.switchyard.component.bean.internal.context.ContextBean;
+import org.switchyard.component.bean.internal.exchange.ExchangeBean;
+import org.switchyard.component.bean.internal.message.MessageBean;
+
+/**
+ * Portable CDI extension for SwitchYard.
+ *
+ * @author tom.fennelly@gmail.com
+ */
+@ApplicationScoped
+public class SwitchYardCDIServiceDiscovery implements Extension {
+
+ /**
+ * Logger
+ */
+ private static Logger _logger = Logger.getLogger(SwitchYardCDIServiceDiscovery.class);
+ /**
+ * Bean deployment metadata.
+ */
+ private BeanDeploymentMetaData _beanDeploymentMetaData;
+ /**
+ * List of created {@link ClientProxyBean} instances.
+ */
+ private List _createdProxyBeans = new ArrayList();
+
+ /**
+ * List of created ReferenceInvokerBean instances.
+ */
+ private List _createdInvokerBeans = new ArrayList();
+
+ /**
+ * {@link javax.enterprise.inject.spi.BeforeBeanDiscovery} CDI event observer.
+ *
+ * @param beforeEvent CDI Event instance.
+ * @param beanManager CDI Bean Manager instance.
+ */
+ public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery beforeEvent, BeanManager beanManager) {
+ _logger.debug("CDI Bean discovery process started.");
+
+ _beanDeploymentMetaData = new BeanDeploymentMetaData();
+ _beanDeploymentMetaData.setBeanManager(beanManager);
+ _beanDeploymentMetaData.setDeploymentClassLoader(Classes.getTCCL());
+ }
+
+ /**
+ * {@link javax.enterprise.inject.spi.ProcessBean} CDI event observer.
+ *
+ * @param processBean CDI Event instance.
+ * @param beanManager CDI Bean Manager instance.
+ */
+ public void processBean(@Observes ProcessBean processBean, BeanManager beanManager) {
+ Bean> bean = processBean.getBean();
+ Set injectionPoints = bean.getInjectionPoints();
+
+ // Create proxies for the relevant injection points...
+ for (InjectionPoint injectionPoint : injectionPoints) {
+ for (Annotation qualifier : injectionPoint.getQualifiers()) {
+ if (Reference.class.isAssignableFrom(qualifier.annotationType())) {
+ Member member = injectionPoint.getMember();
+ if (member instanceof Field) {
+ Class> memberType = ((Field) member).getType();
+ if (memberType.isInterface()) {
+ if (memberType.equals(ReferenceInvoker.class)) {
+ addInvokerBean((Reference)qualifier, injectionPoint.getQualifiers());
+ } else {
+ addInjectableClientProxyBean((Field) member, (Reference) qualifier, injectionPoint.getQualifiers(), beanManager);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ CDIBean cdiBean = new CDIBean(bean, beanManager);
+
+ // Create Service Proxy ExchangeHandlers and register them as Services, for all @Service beans...
+ if (isServiceBean(bean)) {
+ _logger.debug("Adding ServiceDescriptor for bean " + bean.getBeanClass().getName());
+ _beanDeploymentMetaData.addServiceDescriptor(new CDIBeanServiceDescriptor(cdiBean, _beanDeploymentMetaData));
+ }
+
+ // Register all beans in the deployment...
+ _beanDeploymentMetaData.addDeploymentBean(cdiBean);
+ }
+
+ /**
+ * {@link javax.enterprise.inject.spi.ProcessBean} CDI event observer.
+ *
+ * @param afterEvent CDI Event instance.
+ */
+ public void afterBeanDiscovery(@Observes AfterBeanDiscovery afterEvent) {
+ for (ClientProxyBean proxyBean : _createdProxyBeans) {
+ _logger.debug("Adding ClientProxyBean for bean Service " + proxyBean.getServiceName() + ". Service Interface type is " + proxyBean.getServiceInterface().getName());
+ afterEvent.addBean(proxyBean);
+ _beanDeploymentMetaData.addClientProxy(proxyBean);
+ }
+
+ for (ReferenceInvokerBean invokerBean : _createdInvokerBeans) {
+ _logger.debug("Adding ReferenceInvokerBean for bean Service " + invokerBean.getServiceName());
+ afterEvent.addBean(invokerBean);
+ _beanDeploymentMetaData.addReferenceInvoker(invokerBean);
+ }
+
+ afterEvent.addBean(new BeanDeploymentMetaDataCDIBean(_beanDeploymentMetaData));
+ afterEvent.addBean(new ContextBean());
+ afterEvent.addBean(new MessageBean());
+ afterEvent.addBean(new ExchangeBean());
+
+ _logger.debug("CDI Bean discovery process completed.");
+ }
+
+ private void addInjectableClientProxyBean(Field injectionPointField, Reference serviceReference, Set qualifiers, BeanManager beanManager) {
+ final String serviceName;
+
+ if (serviceReference.value().length() > 0) {
+ serviceName = serviceReference.value();
+ } else {
+ serviceName = injectionPointField.getType().getSimpleName();
+ }
+
+ addClientProxyBean(serviceName, injectionPointField.getType(), qualifiers);
+ }
+
+ private void addClientProxyBean(String serviceName, Class> beanClass, Set qualifiers) {
+ // Check do we already have a proxy for this service interface...
+ for (ClientProxyBean clientProxyBean : _createdProxyBeans) {
+ if (serviceName.equals(clientProxyBean.getServiceName()) && beanClass == clientProxyBean.getBeanClass()) {
+ // ignore... we already have a proxy ...
+ return;
+ }
+ }
+
+ ClientProxyBean clientProxyBean = new ClientProxyBean(serviceName, beanClass, qualifiers, _beanDeploymentMetaData);
+ _createdProxyBeans.add(clientProxyBean);
+ }
+
+ private void addInvokerBean(Reference serviceReference, Set qualifiers) {
+ // Value of Reference annotation is required for ReferenceInvoker
+ if (serviceReference.value().length() == 0) {
+ _logger.debug("Unable to create reference invoker for @Reference with missing value");
+ }
+
+ String serviceName = serviceReference.value();
+ // Check do we already have an invoker for this service reference ...
+ for (ReferenceInvokerBean invokerBean : _createdInvokerBeans) {
+ if (serviceName.equals(invokerBean.getServiceName())) {
+ // ignore... we already have a proxy ...
+ return;
+ }
+ }
+
+ ReferenceInvokerBean invokerBean = new ReferenceInvokerBean(serviceName, qualifiers);
+ _createdInvokerBeans.add(invokerBean);
+ }
+
+ private boolean isServiceBean(Bean> bean) {
+ Class> beanClass = bean.getBeanClass();
+ return (Modifier.isPublic(beanClass.getModifiers()) && beanClass.isAnnotationPresent(Service.class));
+ }
+
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/config/model/BeanComponentImplementationModel.java b/components/bean/src/main/java/org/switchyard/component/bean/config/model/BeanComponentImplementationModel.java
new file mode 100644
index 000000000..78b36d184
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/config/model/BeanComponentImplementationModel.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.config.model;
+
+import org.switchyard.config.model.composite.ComponentImplementationModel;
+
+/**
+ * A "bean" ComponentImplementationModel.
+ *
+ * @author David Ward <dward@jboss.org > (C) 2011 Red Hat Inc.
+ */
+public interface BeanComponentImplementationModel extends ComponentImplementationModel {
+
+ /**
+ * The "bean" implementation type.
+ */
+ public static final String BEAN = "bean";
+
+ /**
+ * The "class" attribute.
+ */
+ public static final String CLASS = "class";
+
+ /**
+ * Gets the "class" attribute.
+ *
+ * @return the "class" attribute
+ */
+ public String getClazz();
+
+ /**
+ * Sets the "class" attribute.
+ *
+ * @param clazz the "class" attribute
+ * @return this instance (useful for chaining)
+ */
+ public BeanComponentImplementationModel setClazz(String clazz);
+
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/config/model/BeanNamespace.java b/components/bean/src/main/java/org/switchyard/component/bean/config/model/BeanNamespace.java
new file mode 100644
index 000000000..840bfadd5
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/config/model/BeanNamespace.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bean.config.model;
+
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Namespace;
+
+/**
+ * A Bean config model namespace.
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+public enum BeanNamespace implements Namespace {
+
+ /** The 1.0 namespace. */
+ V_1_0("1.0"),
+ /** The 1.1 namespace. */
+ V_1_1("1.1"),
+ /** The 2.0 namespace. */
+ V_2_0("2.0"),
+ /** The default namespace. */
+ DEFAULT(null);
+
+ private final Util _util;
+
+ /**
+ * Constructs a new BeanNamespace with the specified version.
+ * @param version the specified version, or null to discover the default
+ */
+ BeanNamespace(String version) {
+ _util = new Util(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String section() {
+ return _util.section();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String version() {
+ return _util.version();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean versionMatches(Namespace namespace) {
+ return _util.versionMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String uri() {
+ return _util.uri();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean uriMatches(Namespace namespace) {
+ return _util.uriMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDefault() {
+ return this == DEFAULT || uriMatches(DEFAULT);
+ }
+
+ /**
+ * Gets the BeanNamespace for the specified uri, or null if no matching uris are found.
+ * @param uri the uri
+ * @return the BeanNamespace
+ */
+ public static BeanNamespace fromUri(String uri) {
+ return Util.fromUri(BeanNamespace.class, uri);
+ }
+
+ @SuppressWarnings("serial")
+ private static final class Util extends Namespace.Util {
+ // static final since we only want to do the somewhat expensive work of instantiating this once!
+ private static final Descriptor DESCRIPTOR = new Descriptor(BeanNamespace.class);
+ private Util(String version) {
+ super(DESCRIPTOR, "urn:switchyard-component-bean:config", version);
+ }
+ }
+
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/config/model/BeanSwitchYardScanner.java b/components/bean/src/main/java/org/switchyard/component/bean/config/model/BeanSwitchYardScanner.java
new file mode 100644
index 000000000..70749f9ad
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/config/model/BeanSwitchYardScanner.java
@@ -0,0 +1,265 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.config.model;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.switchyard.annotations.Requires;
+import org.switchyard.common.type.classpath.ClasspathScanner;
+import org.switchyard.common.type.classpath.CompositeFilter;
+import org.switchyard.common.type.classpath.IsAnnotationPresentFilter;
+import org.switchyard.common.type.classpath.PackageFilter;
+import org.switchyard.component.bean.BeanMessages;
+import org.switchyard.component.bean.Reference;
+import org.switchyard.component.bean.Service;
+import org.switchyard.component.bean.config.model.v1.V1BeanComponentImplementationModel;
+import org.switchyard.config.model.Scanner;
+import org.switchyard.config.model.ScannerInput;
+import org.switchyard.config.model.ScannerOutput;
+import org.switchyard.config.model.composite.ComponentModel;
+import org.switchyard.config.model.composite.ComponentReferenceModel;
+import org.switchyard.config.model.composite.ComponentServiceModel;
+import org.switchyard.config.model.composite.CompositeModel;
+import org.switchyard.config.model.composite.InterfaceModel;
+import org.switchyard.config.model.composite.v1.V1ComponentModel;
+import org.switchyard.config.model.composite.v1.V1ComponentReferenceModel;
+import org.switchyard.config.model.composite.v1.V1ComponentServiceModel;
+import org.switchyard.config.model.composite.v1.V1CompositeModel;
+import org.switchyard.config.model.composite.v1.V1InterfaceModel;
+import org.switchyard.config.model.switchyard.SwitchYardModel;
+import org.switchyard.config.model.switchyard.SwitchYardNamespace;
+import org.switchyard.config.model.switchyard.v1.V1SwitchYardModel;
+import org.switchyard.policy.Policy.PolicyType;
+import org.switchyard.policy.SecurityPolicy;
+import org.switchyard.policy.TransactionPolicy;
+
+/**
+ * Bean Scanner.
+ *
+ * @author tom.fennelly@gmail.com
+ */
+public class BeanSwitchYardScanner implements Scanner {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ScannerOutput scan(ScannerInput input) throws IOException {
+ SwitchYardNamespace switchyardNamespace = input.getSwitchyardNamespace();
+ SwitchYardModel switchyardModel = new V1SwitchYardModel(switchyardNamespace.uri());
+ CompositeModel compositeModel = new V1CompositeModel();
+ compositeModel.setName(input.getCompositeName());
+
+ BeanNamespace beanNamespace = BeanNamespace.DEFAULT;
+ for (BeanNamespace value : BeanNamespace.values()) {
+ if (value.versionMatches(switchyardNamespace)) {
+ beanNamespace = value;
+ break;
+ }
+ }
+
+ List> serviceClasses = scanForServiceBeans(input);
+
+ for (Class> serviceClass : serviceClasses) {
+ if (serviceClass.isInterface()) {
+ continue;
+ }
+ if (Modifier.isAbstract(serviceClass.getModifiers())) {
+ continue;
+ }
+
+ ComponentModel componentModel = new V1ComponentModel();
+ ComponentServiceModel serviceModel = new V1ComponentServiceModel(switchyardNamespace.uri());
+ String name = serviceClass.getSimpleName();
+
+ BeanComponentImplementationModel beanModel = new V1BeanComponentImplementationModel(beanNamespace.uri());
+ beanModel.setClazz(serviceClass.getName());
+ componentModel.setImplementation(beanModel);
+
+ Service service = serviceClass.getAnnotation(Service.class);
+ if (service != null) {
+ Class> iface = service.value();
+ if (iface == Service.class) {
+ Class>[] interfaces = serviceClass.getInterfaces();
+ if (interfaces.length == 1) {
+ iface = interfaces[0];
+ } else {
+ throw BeanMessages.MESSAGES.unexpectedExceptionTheServiceAnnotationHasNoValueItCannotBeOmmittedUnlessTheBeanImplementsExactlyOneInterface();
+ }
+ }
+ InterfaceModel csiModel = new V1InterfaceModel(InterfaceModel.JAVA);
+
+ if (service.name().equals(Service.EMPTY)) {
+ name = iface.getSimpleName();
+ } else {
+ name = service.name();
+ }
+
+ serviceModel.setName(name);
+ serviceModel.setInterface(csiModel);
+ csiModel.setInterface(iface.getName());
+
+ componentModel.addService(serviceModel);
+ }
+
+ // Check to see if a policy requirements have been defined
+ Requires requires = serviceClass.getAnnotation(Requires.class);
+ if (requires != null) {
+ for (SecurityPolicy secPolicy : requires.security()) {
+ if (secPolicy == SecurityPolicy.AUTHORIZATION) {
+ // authorization supports both interaction and implementation,
+ // and we want to add it as implementation to be more correct.
+ beanModel.addPolicyRequirement(secPolicy.getQName());
+ } else if (secPolicy.supports(PolicyType.INTERACTION)) {
+ serviceModel.addPolicyRequirement(secPolicy.getQName());
+ } else if (secPolicy.supports(PolicyType.IMPLEMENTATION)) {
+ beanModel.addPolicyRequirement(secPolicy.getQName());
+ } else {
+ throw BeanMessages.MESSAGES.unknownPolicy(secPolicy.toString());
+ }
+ }
+ for (TransactionPolicy txPolicy : requires.transaction()) {
+ if (txPolicy.supports(PolicyType.INTERACTION)) {
+ serviceModel.addPolicyRequirement(txPolicy.getQName());
+ } else if (txPolicy.supports(PolicyType.IMPLEMENTATION)) {
+ beanModel.addPolicyRequirement(txPolicy.getQName());
+ } else {
+ throw BeanMessages.MESSAGES.unknownPolicy(txPolicy.toString());
+ }
+ }
+ // Make sure we don't have conflicting policies
+ QName ptx = TransactionPolicy.PROPAGATES_TRANSACTION.getQName();
+ QName stx = TransactionPolicy.SUSPENDS_TRANSACTION.getQName();
+ if (serviceModel.hasPolicyRequirement(ptx) && serviceModel.hasPolicyRequirement(stx)) {
+ throw BeanMessages.MESSAGES.transactionPoliciesCannotCoexistService(ptx, stx, name);
+ }
+ QName gtx = TransactionPolicy.MANAGED_TRANSACTION_GLOBAL.getQName();
+ QName ltx = TransactionPolicy.MANAGED_TRANSACTION_LOCAL.getQName();
+ QName ntx = TransactionPolicy.NO_MANAGED_TRANSACTION.getQName();
+ if (beanModel.hasPolicyRequirement(gtx) && beanModel.hasPolicyRequirement(ltx)
+ || beanModel.hasPolicyRequirement(gtx) && beanModel.hasPolicyRequirement(ntx)
+ || beanModel.hasPolicyRequirement(ltx) && beanModel.hasPolicyRequirement(ntx)) {
+ throw BeanMessages.MESSAGES.transactionPoliciesCannotCoexistImplementation(gtx, ltx, ntx, name);
+ }
+ }
+
+ // Add any references
+ for (ComponentReferenceModel reference : getReferences(switchyardNamespace, serviceClass, name)) {
+ componentModel.addReference(reference);
+ }
+
+ compositeModel.addComponent(componentModel);
+ componentModel.setName(getComponentName(name, service));
+ compositeModel.addComponent(componentModel);
+ }
+
+ if (!compositeModel.getModelChildren().isEmpty()) {
+ switchyardModel.setComposite(compositeModel);
+ }
+
+ return new ScannerOutput().setModel(switchyardModel);
+ }
+
+ private String getComponentName(String serviceName, Service service) {
+ if (service == null) {
+ return serviceName;
+ }
+ String componentName = service.componentName();
+ return Service.EMPTY.equals(componentName) ? serviceName : componentName;
+ }
+ private List> scanForServiceBeans(ScannerInput input) throws IOException {
+ IsAnnotationPresentFilter annoFilter = new IsAnnotationPresentFilter(Service.class);
+ annoFilter.addType(Reference.class);
+ PackageFilter pkgFilter = new PackageFilter(input.getIncludePackages().toArray(new Package[0]));
+ for (Package pkg : input.getExcludePackages()) {
+ pkgFilter.addExclude(pkg);
+ }
+ CompositeFilter filter = new CompositeFilter(annoFilter, pkgFilter);
+ ClasspathScanner serviceScanner = new ClasspathScanner(filter);
+
+ for (URL url : input.getURLs()) {
+ serviceScanner.scan(url);
+ }
+
+ return filter.getMatchedTypes();
+ }
+
+ /**
+ * Pick up @Reference fields in the specified class and
+ * create corresponding ComponentReferenceModel
+ */
+ private Set getReferences(
+ SwitchYardNamespace switchyardNamespace,
+ Class> serviceClass,
+ String name) throws IOException {
+ HashSet references = new HashSet();
+ for (Field field : serviceClass.getDeclaredFields()) {
+ if (!field.isAnnotationPresent(Reference.class)) {
+ continue;
+ }
+
+ Class> reference = field.getType();
+ ComponentReferenceModel referenceModel = new V1ComponentReferenceModel(switchyardNamespace.uri());
+ InterfaceModel interfaceModel = new V1InterfaceModel(InterfaceModel.JAVA);
+
+ if (field.getAnnotation(Reference.class) != null) {
+ Reference ref = field.getAnnotation(Reference.class);
+ if (ref.value() == null || "".equals(ref.value())) {
+ referenceModel.setName(reference.getSimpleName());
+ } else {
+ QName qname = QName.valueOf(ref.value());
+ referenceModel.setName(qname.getLocalPart());
+ }
+ } else {
+ referenceModel.setName(reference.getSimpleName());
+ }
+
+ referenceModel.setInterface(interfaceModel);
+ interfaceModel.setInterface(reference.getCanonicalName());
+ // Add policy requirements to reference if specified
+ Requires refRequires = field.getAnnotation(Requires.class);
+ if (refRequires != null) {
+ for (SecurityPolicy secPolicy : refRequires.security()) {
+ if (!secPolicy.supports(PolicyType.INTERACTION)) {
+ throw BeanMessages.MESSAGES.referenceOnlyCouldBeMarkedWithInteractionPolicyButIsNotTheOne(secPolicy.toString());
+ }
+ referenceModel.addPolicyRequirement(secPolicy.getQName());
+ }
+ for (TransactionPolicy txPolicy : refRequires.transaction()) {
+ if (!txPolicy.supports(PolicyType.INTERACTION)) {
+ throw BeanMessages.MESSAGES.referenceOnlyCouldBeMarkedWithInteractionPolicyButIsNotTheOne(txPolicy.toString());
+ }
+ referenceModel.addPolicyRequirement(txPolicy.getQName());
+ }
+ // Make sure we don't have conflicting policies
+ QName ptx = TransactionPolicy.PROPAGATES_TRANSACTION.getQName();
+ QName stx = TransactionPolicy.SUSPENDS_TRANSACTION.getQName();
+ if (referenceModel.hasPolicyRequirement(ptx) && referenceModel.hasPolicyRequirement(stx)) {
+ throw BeanMessages.MESSAGES.transactionPoliciesCannotCoexistService(ptx, stx, name);
+ }
+ }
+ references.add(referenceModel);
+ }
+ return references;
+ }
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/config/model/v1/V1BeanComponentImplementationModel.java b/components/bean/src/main/java/org/switchyard/component/bean/config/model/v1/V1BeanComponentImplementationModel.java
new file mode 100644
index 000000000..f17c6a094
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/config/model/v1/V1BeanComponentImplementationModel.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bean.config.model.v1;
+
+import org.switchyard.component.bean.config.model.BeanComponentImplementationModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.composite.v1.V1ComponentImplementationModel;
+
+/**
+ * A "bean" implementation of the BeanComponentImplementationModel.
+ *
+ * @author David Ward <dward@jboss.org > (C) 2011 Red Hat Inc.
+ */
+public class V1BeanComponentImplementationModel extends V1ComponentImplementationModel implements BeanComponentImplementationModel {
+
+ /**
+ * Default constructor for application use.
+ * @param namespace namespace
+ */
+ public V1BeanComponentImplementationModel(String namespace) {
+ super(BEAN, namespace);
+ }
+
+ /**
+ * Constructor for Marshaller use (ie: V1BeanMarshaller).
+ *
+ * @param config the Configuration
+ * @param desc the Descriptor
+ */
+ public V1BeanComponentImplementationModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ @Override
+ public String getClazz() {
+ return getModelAttribute(CLASS);
+ }
+
+ @Override
+ public BeanComponentImplementationModel setClazz(String clazz) {
+ setModelAttribute(CLASS, clazz);
+ return this;
+ }
+
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/config/model/v1/V1BeanMarshaller.java b/components/bean/src/main/java/org/switchyard/component/bean/config/model/v1/V1BeanMarshaller.java
new file mode 100644
index 000000000..7c7bde668
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/config/model/v1/V1BeanMarshaller.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bean.config.model.v1;
+
+import org.switchyard.component.bean.config.model.BeanComponentImplementationModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+import org.switchyard.config.model.composite.ComponentImplementationModel;
+import org.switchyard.config.model.composite.v1.V1CompositeMarshaller;
+
+/**
+ * A CompositeMarshaller which can also create BeanComponentImplementationModels.
+ *
+ * @author David Ward <dward@jboss.org > (C) 2011 Red Hat Inc.
+ */
+public class V1BeanMarshaller extends V1CompositeMarshaller {
+
+ /**
+ * The complete local name ("implementation.bean").
+ */
+ private static final String IMPLEMENTATION_BEAN = ComponentImplementationModel.IMPLEMENTATION + "." + BeanComponentImplementationModel.BEAN;
+
+ /**
+ * Required constructor called via reflection.
+ *
+ * @param desc the Descriptor
+ */
+ public V1BeanMarshaller(Descriptor desc) {
+ super(desc);
+ }
+
+ /**
+ * Reads in the Configuration, looking for "implementation.bean".
+ * If not found, it falls back to the super class (V1CompositeMarshaller).
+ *
+ * @param config the Configuration
+ * @return the Model
+ */
+ @Override
+ public Model read(Configuration config) {
+ if (config.getName().equals(IMPLEMENTATION_BEAN)) {
+ return new V1BeanComponentImplementationModel(config, getDescriptor());
+ }
+ return super.read(config);
+ }
+
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/deploy/BeanComponent.java b/components/bean/src/main/java/org/switchyard/component/bean/deploy/BeanComponent.java
new file mode 100644
index 000000000..be25c285b
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/deploy/BeanComponent.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bean.deploy;
+
+import org.switchyard.ServiceDomain;
+import org.switchyard.deploy.Activator;
+import org.switchyard.deploy.BaseComponent;
+
+/**
+ * An implementation of Bean component.
+ *
+ * @author Magesh Kumar B (C) 2011 Red Hat Inc.
+ */
+public class BeanComponent extends BaseComponent {
+
+ /**
+ * Default constructor.
+ */
+ public BeanComponent() {
+ super(BeanComponentActivator.BEAN_TYPE);
+ setName("BeanComponent");
+ }
+
+ /* (non-Javadoc)
+ * @see org.switchyard.deploy.Component#createActivator(org.switchyard.ServiceDomain)
+ */
+ @Override
+ public Activator createActivator(ServiceDomain domain) {
+ BeanComponentActivator activator = new BeanComponentActivator();
+ activator.setServiceDomain(domain);
+ return activator;
+ }
+
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/deploy/BeanComponentActivator.java b/components/bean/src/main/java/org/switchyard/component/bean/deploy/BeanComponentActivator.java
new file mode 100644
index 000000000..4d3496c39
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/deploy/BeanComponentActivator.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.deploy;
+
+import javax.xml.namespace.QName;
+
+import org.switchyard.common.property.PropertyResolver;
+import org.switchyard.component.bean.ClientProxyBean;
+import org.switchyard.component.bean.ServiceProxyHandler;
+import org.switchyard.component.bean.internal.ReferenceInvokerBean;
+import org.switchyard.config.model.composite.ComponentModel;
+import org.switchyard.config.model.composite.ComponentReferenceModel;
+import org.switchyard.deploy.BaseActivator;
+import org.switchyard.deploy.ComponentNames;
+import org.switchyard.deploy.ServiceHandler;
+import org.switchyard.metadata.ServiceInterface;
+import org.switchyard.component.bean.BeanMessages;
+
+/**
+ * The Bean Component Activator.
+ *
+ * @author tom.fennelly@gmail.com
+ */
+public class BeanComponentActivator extends BaseActivator {
+
+ /**
+ * Bean component activator type name.
+ */
+ public static final String BEAN_TYPE = "bean";
+
+ private BeanDeploymentMetaData _beanDeploymentMetaData;
+
+ /**
+ * Public constructor.
+ */
+ public BeanComponentActivator() {
+ super(BEAN_TYPE);
+ }
+
+
+ @Override
+ public ServiceHandler activateService(QName serviceName, ComponentModel config) {
+ lookupBeanMetaData();
+
+ // This is a bit of a kludge - catches cases where an implementation
+ // does not provide a service, only a reference
+ if (serviceName == null) {
+ for (ComponentReferenceModel reference : config.getReferences()) {
+ for (ClientProxyBean proxyBean : _beanDeploymentMetaData.getClientProxies()) {
+ if (reference.getQName().getLocalPart().equals(proxyBean.getServiceName())) {
+ QName refName = ComponentNames.qualify(config.getQName(), reference.getQName());
+ proxyBean.setService(getServiceDomain().getServiceReference(refName));
+ }
+ }
+ for (ReferenceInvokerBean invokerBean : _beanDeploymentMetaData.getReferenceInvokers()) {
+ if (reference.getQName().getLocalPart().equals(invokerBean.getServiceName())) {
+ QName refName = ComponentNames.qualify(config.getQName(), reference.getQName());
+ invokerBean.setReference(getServiceDomain().getServiceReference(refName));
+ }
+ }
+ }
+ return null;
+ }
+
+ PropertyResolver resolver = config.getModelConfiguration().getPropertyResolver();
+ for (ServiceDescriptor descriptor : _beanDeploymentMetaData.getServiceDescriptors()) {
+ if (descriptor.getServiceName().equals(serviceName.getLocalPart())) {
+ ServiceProxyHandler handler = descriptor.getHandler();
+ for (ComponentReferenceModel reference : config.getReferences()) {
+ QName refName = ComponentNames.qualify(config.getQName(), reference.getQName());
+ handler.addReference(getServiceDomain().getServiceReference(refName));
+ }
+ handler.injectImplementationProperties(resolver);
+ return handler;
+ }
+ }
+ // bean discovery did not find a bean providing this service
+ throw BeanMessages.MESSAGES.unknownServiceName(serviceName.toString());
+ }
+
+ @Override
+ public void deactivateService(QName name, ServiceHandler handler) {
+ // NOP - CDI subsystem will pull down the CDI bits and pieces
+ }
+
+ /**
+ * Looks up Bean meta data.
+ */
+ public void lookupBeanMetaData() {
+ _beanDeploymentMetaData = BeanDeploymentMetaData.lookupBeanDeploymentMetaData();
+ }
+
+ /**
+ * Create a ServiceInterface instance for the named Service.
+ * @param name The Service Name.
+ * @return The ServiceInterface instance.
+ */
+ public ServiceInterface buildServiceInterface(String name) {
+ for (ServiceDescriptor descriptor : _beanDeploymentMetaData.getServiceDescriptors()) {
+ if (descriptor.getServiceName().equals(name)) {
+ return descriptor.getInterface();
+ }
+ }
+ // bean discovery did not find a bean providing this service
+ throw BeanMessages.MESSAGES.unknownServiceName(name);
+ }
+
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/deploy/BeanDeploymentMetaData.java b/components/bean/src/main/java/org/switchyard/component/bean/deploy/BeanDeploymentMetaData.java
new file mode 100644
index 000000000..e9a0b6ce5
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/deploy/BeanDeploymentMetaData.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.deploy;
+
+
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import org.switchyard.common.cdi.CDIUtil;
+import org.switchyard.component.bean.ClientProxyBean;
+import org.switchyard.component.bean.BeanMessages;
+import org.switchyard.component.bean.internal.ReferenceInvokerBean;
+
+/**
+ * Bean Deployment Meta Data.
+ *
+ * All the CDI bean info for a specific deployment. This bean is actually
+ * managed by BeanDeploymentMetaDataCDIBean.
+ *
+ * @author tom.fennelly@gmail.com
+ */
+@Alternative
+public class BeanDeploymentMetaData {
+
+ private BeanManager _beanManager;
+ private ClassLoader _deploymentClassLoader;
+ private List _serviceDescriptors = new ArrayList();
+ private List _clientProxies = new ArrayList();
+ private List _referenceInvokers = new ArrayList();
+ private List _deploymentBeans = new ArrayList();
+
+ /**
+ * Default no-arg constructor.
+ */
+ public BeanDeploymentMetaData() {}
+
+ /**
+ * Set the deployment CDI BeanManager.
+ * @param beanManager The bean manager.
+ * @return this instance.
+ */
+ public BeanDeploymentMetaData setBeanManager(BeanManager beanManager) {
+ _beanManager = beanManager;
+ return this;
+ }
+
+ /**
+ * Get the deployment CDI BeanManager.
+ * @return The bean manager.
+ */
+ public BeanManager getBeanManager() {
+ return _beanManager;
+ }
+
+ /**
+ * Set the deployment ClassLoader.
+ * @param deploymentClassLoader The deployment ClassLoader.
+ * @return this instance.
+ */
+ public BeanDeploymentMetaData setDeploymentClassLoader(ClassLoader deploymentClassLoader) {
+ _deploymentClassLoader = deploymentClassLoader;
+ return this;
+ }
+
+ /**
+ * Get the deployment ClassLoader.
+ * @return The deployment ClassLoader.
+ */
+ public ClassLoader getDeploymentClassLoader() {
+ return _deploymentClassLoader;
+ }
+
+ /**
+ * Add a {@link ServiceDescriptor}.
+ * @param serviceDescriptor The descriptor instance.
+ */
+ public void addServiceDescriptor(ServiceDescriptor serviceDescriptor) {
+ _serviceDescriptors.add(serviceDescriptor);
+ }
+
+ /**
+ * Add a {@link ClientProxyBean}.
+ * @param proxy The proxy instance.
+ */
+ public void addClientProxy(ClientProxyBean proxy) {
+ _clientProxies.add(proxy);
+ }
+
+ /**
+ * Add a ReferenceInvokerBean.
+ * @param invoker The invoker bean.
+ */
+ public void addReferenceInvoker(ReferenceInvokerBean invoker) {
+ _referenceInvokers.add(invoker);
+ }
+
+ /**
+ * Add a deployment CDI bean.
+ * @param bean The CDI bean instance.
+ */
+ public void addDeploymentBean(CDIBean bean) {
+ _deploymentBeans.add(bean);
+ }
+
+ /**
+ * Add a list of all the {@link ServiceDescriptor ServiceDescriptors}.
+ * @return The list of all the {@link ServiceDescriptor ServiceDescriptors}.
+ */
+ public List getServiceDescriptors() {
+ return Collections.unmodifiableList(_serviceDescriptors);
+ }
+
+ /**
+ * Get a list of all the {@link ClientProxyBean ClientProxyBeans}.
+ * @return The list of all the {@link ClientProxyBean ClientProxyBeans}.
+ */
+ public List getClientProxies() {
+ return Collections.unmodifiableList(_clientProxies);
+ }
+
+ /**
+ * Get a list of all the ReferenceInvokerBeans.
+ * @return The list of all the ReferenceInvokerBeans.
+ */
+ public List getReferenceInvokers() {
+ return Collections.unmodifiableList(_referenceInvokers);
+ }
+
+ /**
+ * Get a list of all beans in the deployment.
+ * @return The list of all beans in the deployment.
+ */
+ public List getDeploymentBeans() {
+ return Collections.unmodifiableList(_deploymentBeans);
+ }
+
+ /**
+ * Lookup the BeanDeploymentMetaData for the current deployment.
+ * @return The BeanDeploymentMetaData.
+ */
+ public static BeanDeploymentMetaData lookupBeanDeploymentMetaData() {
+ BeanManager beanManager = CDIUtil.lookupBeanManager();
+ if (beanManager == null) {
+ throw BeanMessages.MESSAGES.failedToLookupBeanManagerMustBeBoundIntoJavaCompAsPerCDISpecification();
+ }
+
+ Set> beans = beanManager.getBeans(BeanDeploymentMetaData.class);
+ if (beans.isEmpty()) {
+ throw BeanMessages.MESSAGES.failedToLookupBeanDeploymentMetaDataFromBeanManagerMustBeBoundIntoBeanManagerPerhapsSwitchYardCDIExtensionsNotProperlyInstalledInContainer();
+ }
+ if (beans.size() > 1) {
+ throw BeanMessages.MESSAGES.failedToLookupBeanDeploymentMetaDataFromBeanManagerMultipleBeansResolvedForType(BeanDeploymentMetaData.class.getName());
+ }
+
+ BeanDeploymentMetaDataCDIBean bean = (BeanDeploymentMetaDataCDIBean) beans.iterator().next();
+ return bean.getBeanMetaData();
+ }
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/deploy/BeanDeploymentMetaDataCDIBean.java b/components/bean/src/main/java/org/switchyard/component/bean/deploy/BeanDeploymentMetaDataCDIBean.java
new file mode 100644
index 000000000..3ac855c6a
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/deploy/BeanDeploymentMetaDataCDIBean.java
@@ -0,0 +1,187 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.deploy;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.util.AnnotationLiteral;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * BeanDeploymentMetaData CDI Bean.
+ *
+ * @author tom.fennelly@gmail.com
+ */
+public class BeanDeploymentMetaDataCDIBean implements Bean {
+
+ /**
+ * Bean deployment metadata.
+ */
+ private BeanDeploymentMetaData _beanMetaData;
+ /**
+ * CDI bean qualifiers. See CDI Specification.
+ */
+ private Set _qualifiers;
+
+ /**
+ * Public constructor.
+ * @param beanDeploymentMetaData Bean metadata.
+ */
+ public BeanDeploymentMetaDataCDIBean(BeanDeploymentMetaData beanDeploymentMetaData) {
+ _beanMetaData = beanDeploymentMetaData;
+ this._qualifiers = new HashSet();
+ this._qualifiers.add(new AnnotationLiteral() {});
+ this._qualifiers.add(new AnnotationLiteral() {});
+ }
+
+ /**
+ * Get the BeanDeploymentMetaData.
+ * @return The BeanDeploymentMetaData.
+ */
+ public BeanDeploymentMetaData getBeanMetaData() {
+ return _beanMetaData;
+ }
+
+ /**
+ * Obtains the {@linkplain javax.enterprise.inject bean types} of the bean.
+ *
+ * @return the {@linkplain javax.enterprise.inject bean types}
+ */
+ public Set getTypes() {
+ Set types = new HashSet();
+ types.add(BeanDeploymentMetaData.class);
+ types.add(Object.class);
+ return types;
+ }
+
+ /**
+ * Obtains the {@linkplain javax.inject.Qualifier qualifiers} of the bean.
+ *
+ * @return the {@linkplain javax.inject.Qualifier qualifiers}
+ */
+ public Set getQualifiers() {
+ return _qualifiers;
+ }
+
+ /**
+ * Obtains the {@linkplain javax.enterprise.inject EL name} of a bean, if it has one.
+ *
+ * @return the {@linkplain javax.enterprise.inject EL name}
+ */
+ public String getName() {
+ return null;
+ }
+
+ /**
+ * Obtains the {@linkplain javax.enterprise.inject.Stereotype stereotypes}
+ * of the bean.
+ *
+ * @return the set of {@linkplain javax.enterprise.inject.Stereotype stereotypes}
+ */
+ public Set> getStereotypes() {
+ return Collections.emptySet();
+ }
+
+ /**
+ * The bean {@linkplain Class class} of the managed bean or session bean or
+ * of the bean that declares the producer method or field.
+ *
+ * @return the bean {@linkplain Class class}
+ */
+ public Class> getBeanClass() {
+ return BeanDeploymentMetaData.class;
+ }
+
+ /**
+ * Determines if the bean is an
+ * {@linkplain javax.enterprise.inject.Alternative alternative}.
+ *
+ * @return true if the bean is an
+ * {@linkplain javax.enterprise.inject.Alternative alternative},
+ * and false otherwise.
+ */
+ public boolean isAlternative() {
+ return false;
+ }
+
+ /**
+ * Determines if
+ * {@link javax.enterprise.context.spi.Contextual#create(javax.enterprise.context.spi.CreationalContext)}
+ * sometimes return a null value.
+ *
+ * @return true if the {@code create()} method may return a null
+ * value, and false otherwise
+ */
+ public boolean isNullable() {
+ return false;
+ }
+
+ /**
+ * Obtains the {@link javax.enterprise.inject.spi.InjectionPoint} objects
+ * representing injection points of the bean, that will be validated by the
+ * container at initialization time.
+ *
+ * @return the set of {@linkplain javax.enterprise.inject.spi.InjectionPoint injection points} of the bean
+ */
+ public Set getInjectionPoints() {
+ return Collections.emptySet();
+ }
+
+ /**
+ * Obtains the {@linkplain javax.enterprise.context scope} of the bean.
+ *
+ * @return the {@linkplain javax.enterprise.context scope}
+ */
+ public Class extends Annotation> getScope() {
+ return ApplicationScoped.class;
+ }
+
+ /**
+ * Create a new instance of the contextual type. Instances should
+ * use the given {@link javax.enterprise.context.spi.CreationalContext}
+ * when obtaining contextual references to inject, in order to ensure
+ * that any dependent objects are associated with the contextual instance
+ * that is being created. An implementation may call
+ * {@link javax.enterprise.context.spi.CreationalContext#push(Object)}
+ * between instantiation and injection to help the container minimize the
+ * use of client proxy objects.
+ *
+ * @param creationalContext the context in which this instance is being created
+ * @return the contextual instance
+ */
+ public Object create(CreationalContext creationalContext) {
+ return _beanMetaData;
+ }
+
+ /**
+ * Destroy an instance of the contextual type. Implementations should
+ * call {@link javax.enterprise.context.spi.CreationalContext#release()}
+ * to allow the container to destroy dependent objects of the contextual
+ * instance.
+ *
+ * @param instance the contextual instance to destroy
+ * @param creationalContext the context in which this instance was created
+ */
+ public void destroy(Object instance, CreationalContext creationalContext) {
+ }
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/deploy/CDIBean.java b/components/bean/src/main/java/org/switchyard/component/bean/deploy/CDIBean.java
new file mode 100644
index 000000000..35c02d50d
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/deploy/CDIBean.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.deploy;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+/**
+ * CDI Bean instance.
+ *
+ * @author tom.fennelly@gmail.com
+ */
+public class CDIBean {
+
+ private Bean _bean;
+ private BeanManager _beanManager;
+
+ /**
+ * Public constructor.
+ * @param bean The bean isntance.
+ * @param beanManager The bean manager.
+ */
+ public CDIBean(Bean bean, BeanManager beanManager) {
+ this._bean = bean;
+ this._beanManager = beanManager;
+ }
+
+ /**
+ * Get the CDI Bean instance.
+ * @return The CDI bean instance.
+ */
+ public Bean getBean() {
+ return _bean;
+ }
+
+ /**
+ * Get the CDI BeanManager instance.
+ * @return The CDI BeanManager instance.
+ */
+ public BeanManager getBeanManager() {
+ return _beanManager;
+ }
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/deploy/CDIBeanServiceDescriptor.java b/components/bean/src/main/java/org/switchyard/component/bean/deploy/CDIBeanServiceDescriptor.java
new file mode 100644
index 000000000..8aef040e1
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/deploy/CDIBeanServiceDescriptor.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bean.deploy;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.switchyard.common.lang.Strings;
+import org.switchyard.component.bean.BeanServiceMetadata;
+import org.switchyard.component.bean.BeanMessages;
+import org.switchyard.component.bean.Service;
+import org.switchyard.component.bean.ServiceProxyHandler;
+import org.switchyard.extensions.java.JavaService;
+import org.switchyard.metadata.ServiceInterface;
+
+/**
+ * SwitchYard CDI bean Service Descriptor.
+ *
+ * @author tom.fennelly@gmail.com
+ */
+public class CDIBeanServiceDescriptor implements ServiceDescriptor {
+
+ private final CDIBean _cdiBean;
+ private final BeanDeploymentMetaData _beanDeploymentMetaData;
+ private final String _serviceName;
+ private final BeanServiceMetadata _serviceMetadata;
+
+ /**
+ * Public constructor.
+ * @param cdiBean The CDI bean instance.
+ * @param beanDeploymentMetaData bean deployment info
+ */
+ public CDIBeanServiceDescriptor(CDIBean cdiBean, BeanDeploymentMetaData beanDeploymentMetaData) {
+ this._cdiBean = cdiBean;
+ this._beanDeploymentMetaData = beanDeploymentMetaData;
+ final Class> beanClass = cdiBean.getBean().getBeanClass();
+ this._serviceName = getServiceName(beanClass);
+ this._serviceMetadata = new BeanServiceMetadata(getServiceInterface(beanClass));
+ }
+
+ /**
+ * Get the CDI bean.
+ * @return The CDI bean.
+ */
+ public CDIBean getCDIBean() {
+ return _cdiBean;
+ }
+
+ @Override
+ public String getServiceName() {
+ return _serviceName;
+ }
+
+ /**
+ * Get the service metadata.
+ * @return The service metadata.
+ */
+ public BeanServiceMetadata getServiceMetadata() {
+ return _serviceMetadata;
+ }
+
+ @Override
+ public ServiceProxyHandler getHandler() {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(_beanDeploymentMetaData.getDeploymentClassLoader());
+
+ BeanManager beanManager = _cdiBean.getBeanManager();
+ CreationalContext creationalContext = beanManager.createCreationalContext(_cdiBean.getBean());
+ Object beanRef = beanManager.getReference(_cdiBean.getBean(), Object.class, creationalContext);
+
+ return new ServiceProxyHandler(beanRef, _serviceMetadata, _beanDeploymentMetaData);
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+
+ @Override
+ public ServiceInterface getInterface() {
+ return JavaService.fromClass(_serviceMetadata.getServiceClass());
+ }
+
+ private String getServiceName(Class> beanClass) {
+ Service service = beanClass.getAnnotation(Service.class);
+ String name = Strings.trimToNull(service.name());
+ if (name == null) {
+ name = getServiceInterface(beanClass).getSimpleName();
+ }
+ return name;
+ }
+
+ /**
+ * Get the service interface defined by a service bean class.
+ * @param beanClass The bean class.
+ * @return The Service Interface type.
+ */
+ protected static Class> getServiceInterface(Class> beanClass) {
+ Service serviceAnnotation = beanClass.getAnnotation(Service.class);
+ Class> serviceInterface = serviceAnnotation.value();
+
+ if (serviceInterface == Service.class) {
+ Class>[] interfaces = beanClass.getInterfaces();
+ if (interfaces.length == 1) {
+ serviceInterface = interfaces[0];
+ } else {
+ throw BeanMessages.MESSAGES.unexpectedExceptionTheServiceAnnotationHasNoValueItCannotBeOmmittedUnlessTheBeanImplementsExactlyOneInterface();
+ }
+ } else if (!serviceInterface.isInterface()) {
+ throw BeanMessages.MESSAGES.invalidServiceSpecificationService(serviceInterface.getName());
+ }
+
+ return serviceInterface;
+ }
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/deploy/ServiceDescriptor.java b/components/bean/src/main/java/org/switchyard/component/bean/deploy/ServiceDescriptor.java
new file mode 100644
index 000000000..fc9895972
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/deploy/ServiceDescriptor.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.deploy;
+
+import java.io.Serializable;
+
+import org.switchyard.component.bean.ServiceProxyHandler;
+import org.switchyard.metadata.ServiceInterface;
+
+/**
+ * Service Descriptor.
+ *
+ * @author tom.fennelly@gmail.com
+ */
+public interface ServiceDescriptor extends Serializable {
+
+ /**
+ * Get the Service name.
+ * @return The Service Name.
+ */
+ String getServiceName();
+
+ /**
+ * Get the ServiceHandler.
+ * @return The ServiceHandler.
+ */
+ ServiceProxyHandler getHandler();
+
+ /**
+ * Get the ServiceInterface.
+ * @return The ServiceInterface.
+ */
+ ServiceInterface getInterface();
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/internal/ExchangeInvocation.java b/components/bean/src/main/java/org/switchyard/component/bean/internal/ExchangeInvocation.java
new file mode 100644
index 000000000..d79d9745f
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/internal/ExchangeInvocation.java
@@ -0,0 +1,109 @@
+package org.switchyard.component.bean.internal;
+
+import org.switchyard.Context;
+import org.switchyard.Exchange;
+import org.switchyard.HandlerException;
+import org.switchyard.Message;
+import org.switchyard.component.bean.ReferenceInvocation;
+
+/**
+ * Implements ReferenceInvocation backed by an exchange.
+ */
+public class ExchangeInvocation implements ReferenceInvocation {
+
+ private Exchange _exchange;
+ private Message _inMessage;
+ private InvocationResponseHandler _replyHandler;
+
+ /**
+ * Create a new instance of ExchangeInvocation.
+ * @param exchange exchange to be used for the invocation
+ * @param replyHandler takes care of replies/faults for the exchange
+ */
+ public ExchangeInvocation(Exchange exchange, InvocationResponseHandler replyHandler) {
+ _exchange = exchange;
+ _inMessage = _exchange.createMessage();
+ _replyHandler = replyHandler;
+ }
+
+ @Override
+ public Context getContext() {
+ return _exchange.getContext();
+ }
+
+ @Override
+ public Message getMessage() {
+ return isNew() ? _inMessage : _exchange.getMessage();
+ }
+
+ @Override
+ public ReferenceInvocation invoke() throws Exception {
+ if (!isNew()) {
+ throw new IllegalStateException(
+ "Repeated calls to invoke() on ExchangeInvocation are not permitted");
+ }
+ _exchange.send(_inMessage);
+ if (_replyHandler.isFault()) {
+ Object error = _replyHandler.getExchange().getMessage().getContent();
+
+ // Handling case where fault content is not an exception
+ if (!Throwable.class.isAssignableFrom(error.getClass())) {
+ throw createException(_replyHandler.getExchange());
+ }
+
+ // Unwrap HandlerException instances if appropriate
+ if (error instanceof HandlerException) {
+ HandlerException haEx = (HandlerException)error;
+ error = haEx.isWrapper() ? haEx.getCause() : haEx;
+ }
+
+ // Time to throw up!
+ if (error instanceof Exception) {
+ throw (Exception)error;
+ } else {
+ throw new Exception((Throwable)error);
+ }
+ }
+ return this;
+ }
+
+ @Override
+ public ReferenceInvocation invoke(Object content) throws Exception {
+ _inMessage.setContent(content);
+ return invoke();
+ }
+
+ @Override
+ public ReferenceInvocation setProperty(String name, String value) {
+ _exchange.getContext(_inMessage).setProperty(name, value);
+ return this;
+ }
+
+ @Override
+ public Object getProperty(String name) {
+ return _exchange.getContext().getPropertyValue(name);
+ }
+
+ boolean isNew() {
+ return _exchange.getPhase() == null;
+ }
+
+ /**
+ * Utility method to create consistent exceptions for invocations.
+ */
+ Exception createException(Exchange exchange) {
+ String exMsg = null;
+ try {
+ // Attempt to convert to String
+ exMsg = exchange.getMessage().getContent(String.class);
+ } catch (Exception ex) {
+ // No luck converting, go with toString
+ Object content = exchange.getMessage().getContent();
+ if (content != null) {
+ exMsg = content.toString();
+ }
+ }
+ return new Exception(exMsg);
+ }
+
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/internal/InternalBean.java b/components/bean/src/main/java/org/switchyard/component/bean/internal/InternalBean.java
new file mode 100644
index 000000000..0642e4062
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/internal/InternalBean.java
@@ -0,0 +1,201 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bean.internal;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.util.AnnotationLiteral;
+
+/**
+ * Internal Bean.
+ *
+ * CDI bean for injecting a SwitchYard Object into consumer beans.
+ *
+ * @author tom.fennelly@gmail.com
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+public abstract class InternalBean implements Bean {
+
+ /**
+ * CDI bean qualifiers. See CDI Specification.
+ */
+ private Set _qualifiers;
+
+ /**
+ * Proxy object.
+ */
+ private Object _proxyObject;
+
+ /**
+ * Bean class.
+ */
+ private final Class> _beanClass;
+
+ /**
+ * Used when the proxy object is created/managed by extensions of this class.
+ */
+ protected InternalBean(Class> beanClass, Set qualifiers) {
+ _qualifiers = qualifiers;
+ _beanClass = beanClass;
+ }
+
+ /**
+ * Protected constructor.
+ */
+ protected InternalBean(Object proxyObject, Class> beanClass) {
+ _qualifiers = new HashSet();
+ _qualifiers.add(new AnnotationLiteral() {});
+ _qualifiers.add(new AnnotationLiteral() {});
+ _proxyObject = proxyObject;
+ _beanClass = beanClass;
+ }
+
+ /**
+ * Obtains the {@linkplain javax.enterprise.inject bean types} of the bean.
+ *
+ * @return the {@linkplain javax.enterprise.inject bean types}
+ */
+ public Set getTypes() {
+ Set types = new HashSet();
+ types.add(_beanClass);
+ types.add(Object.class);
+ return types;
+ }
+
+ /**
+ * Obtains the {@linkplain javax.inject.Qualifier qualifiers} of the bean.
+ *
+ * @return the {@linkplain javax.inject.Qualifier qualifiers}
+ */
+ public Set getQualifiers() {
+ return _qualifiers;
+ }
+
+ /**
+ * Obtains the {@linkplain javax.enterprise.inject EL name} of a bean, if it has one.
+ *
+ * @return the {@linkplain javax.enterprise.inject EL name}
+ */
+ public String getName() {
+ return null;
+ }
+
+ protected void setProxyObject(Object proxyObject) {
+ _proxyObject = proxyObject;
+ }
+
+ /**
+ * Obtains the {@linkplain javax.enterprise.inject.Stereotype stereotypes}
+ * of the bean.
+ *
+ * @return the set of {@linkplain javax.enterprise.inject.Stereotype stereotypes}
+ */
+ public Set> getStereotypes() {
+ return Collections.emptySet();
+ }
+
+ /**
+ * The bean {@linkplain Class class} of the managed bean or session bean or
+ * of the bean that declares the producer method or field.
+ *
+ * @return the bean {@linkplain Class class}
+ */
+ public Class> getBeanClass() {
+ return _beanClass;
+ }
+
+ /**
+ * Determines if the bean is an
+ * {@linkplain javax.enterprise.inject.Alternative alternative}.
+ *
+ * @return true if the bean is an
+ * {@linkplain javax.enterprise.inject.Alternative alternative},
+ * and false otherwise.
+ */
+ public boolean isAlternative() {
+ return false;
+ }
+
+ /**
+ * Determines if
+ * {@link javax.enterprise.context.spi.Contextual#create(javax.enterprise.context.spi.CreationalContext)}
+ * sometimes return a null value.
+ *
+ * @return true if the {@code create()} method may return a null
+ * value, and false otherwise
+ */
+ public boolean isNullable() {
+ return false;
+ }
+
+ /**
+ * Obtains the {@link javax.enterprise.inject.spi.InjectionPoint} objects
+ * representing injection points of the bean, that will be validated by the
+ * container at initialization time.
+ *
+ * @return the set of {@linkplain javax.enterprise.inject.spi.InjectionPoint injection points} of the bean
+ */
+ public Set getInjectionPoints() {
+ return Collections.emptySet();
+ }
+
+ /**
+ * Obtains the {@linkplain javax.enterprise.context scope} of the bean.
+ *
+ * @return the {@linkplain javax.enterprise.context scope}
+ */
+ public Class extends Annotation> getScope() {
+ return ApplicationScoped.class;
+ }
+
+ /**
+ * Create a new instance of the contextual type. Instances should
+ * use the given {@link javax.enterprise.context.spi.CreationalContext}
+ * when obtaining contextual references to inject, in order to ensure
+ * that any dependent objects are associated with the contextual instance
+ * that is being created. An implementation may call
+ * {@link javax.enterprise.context.spi.CreationalContext#push(Object)}
+ * between instantiation and injection to help the container minimize the
+ * use of client proxy objects.
+ *
+ * @param creationalContext the context in which this instance is being created
+ * @return the contextual instance
+ */
+ public Object create(CreationalContext creationalContext) {
+ return _proxyObject;
+ }
+
+ /**
+ * Destroy an instance of the contextual type. Implementations should
+ * call {@link javax.enterprise.context.spi.CreationalContext#release()}
+ * to allow the container to destroy dependent objects of the contextual
+ * instance.
+ *
+ * @param instance the contextual instance to destroy
+ * @param creationalContext the context in which this instance was created
+ */
+ public void destroy(Object instance, CreationalContext creationalContext) {
+ }
+
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/internal/InvocationResponseHandler.java b/components/bean/src/main/java/org/switchyard/component/bean/internal/InvocationResponseHandler.java
new file mode 100644
index 000000000..12343259f
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/internal/InvocationResponseHandler.java
@@ -0,0 +1,43 @@
+package org.switchyard.component.bean.internal;
+
+import org.switchyard.Exchange;
+import org.switchyard.ExchangeHandler;
+import org.switchyard.HandlerException;
+
+/**
+ * Used to handle responses and faults for exchanges used by an
+ * ExchangeInvoker.
+ */
+public class InvocationResponseHandler implements ExchangeHandler {
+
+ private Exchange _exchange;
+ private boolean _isFault;
+
+ @Override
+ public void handleMessage(Exchange exchange) throws HandlerException {
+ _exchange = exchange;
+ }
+
+ @Override
+ public void handleFault(Exchange exchange) {
+ _isFault = true;
+ _exchange = exchange;
+ }
+
+ /**
+ * Reports whether the exchange is in fault state.
+ * @return true if the exchange resulted in a fault, false otherwise
+ */
+ public boolean isFault() {
+ return _isFault;
+ }
+
+ /**
+ * Gets the Exchange object received with a fault/reply message.
+ * @return exchange
+ */
+ public Exchange getExchange() {
+ return _exchange;
+ }
+
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/internal/ReferenceInvokerBean.java b/components/bean/src/main/java/org/switchyard/component/bean/internal/ReferenceInvokerBean.java
new file mode 100644
index 000000000..629ac1f25
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/internal/ReferenceInvokerBean.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bean.internal;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import org.switchyard.Exchange;
+import org.switchyard.ServiceReference;
+import org.switchyard.component.bean.ReferenceInvocation;
+import org.switchyard.component.bean.ReferenceInvoker;
+import org.switchyard.metadata.ServiceInterface;
+
+/**
+ * Bean class used to inject a ReferenceInvoker for an @Reference in a bean class.
+ */
+public class ReferenceInvokerBean extends InternalBean implements ReferenceInvoker {
+
+ private final String _serviceName;
+ private ServiceReference _reference;
+
+ /**
+ * Creates a new ReferenceInvokerBean.
+ * @param serviceName name of the service reference
+ * @param qualifiers any qualifiers associated with the injection point
+ */
+ public ReferenceInvokerBean(String serviceName, Set qualifiers) {
+ super(ReferenceInvoker.class, qualifiers);
+ setProxyObject(this);
+ _serviceName = serviceName;
+ }
+
+ /**
+ * Get the name of the service used by the invoker.
+ * @return service name
+ */
+ public String getServiceName() {
+ return _serviceName;
+ }
+
+ /**
+ * Set the service reference for the target service.
+ * @param reference The target service.
+ */
+ public void setReference(ServiceReference reference) {
+ _reference = reference;
+ }
+
+ /**
+ * Returns the service reference used by this invoker.
+ * @return target reference
+ */
+ public ServiceReference getReference() {
+ return _reference;
+ }
+
+ @Override
+ public ReferenceInvocation newInvocation() {
+ assertReference();
+ ServiceInterface intf = _reference.getInterface();
+ if (intf.getOperations().size() != 1) {
+ throw new IllegalStateException("Operation name is required to create ReferenceInvocation for " + _serviceName);
+ }
+
+ return newInvocation(intf.getOperations().iterator().next().getName());
+ }
+
+ @Override
+ public ReferenceInvocation newInvocation(String operation) {
+ assertReference();
+ InvocationResponseHandler handler = new InvocationResponseHandler();
+ Exchange exchange = _reference.createExchange(operation, handler);
+ return new ExchangeInvocation(exchange, handler);
+ }
+
+ @Override
+ public ServiceInterface getContract() {
+ return _reference.getInterface();
+ }
+
+ private void assertReference() throws IllegalStateException {
+ if (_reference == null) {
+ throw new IllegalStateException("Reference does not exist for service: " + _serviceName);
+ }
+ }
+
+}
+
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/internal/SimpleCDIDeployment.java b/components/bean/src/main/java/org/switchyard/component/bean/internal/SimpleCDIDeployment.java
new file mode 100644
index 000000000..a550bc280
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/internal/SimpleCDIDeployment.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.internal;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.switchyard.ServiceDomain;
+import org.switchyard.ServiceReference;
+import org.switchyard.common.xml.XMLHelper;
+import org.switchyard.component.bean.BeanMessages;
+import org.switchyard.component.bean.ServiceProxyHandler;
+import org.switchyard.component.bean.deploy.BeanComponentActivator;
+import org.switchyard.component.bean.deploy.BeanDeploymentMetaData;
+import org.switchyard.component.bean.deploy.CDIBean;
+import org.switchyard.component.bean.deploy.ServiceDescriptor;
+import org.switchyard.deploy.Activator;
+import org.switchyard.deploy.Lifecycle;
+import org.switchyard.deploy.internal.AbstractDeployment;
+import org.switchyard.metadata.ServiceInterface;
+import org.switchyard.transform.TransformerRegistry;
+import org.switchyard.transform.internal.TransformerTypes;
+import org.switchyard.transform.internal.TransformerUtil;
+
+/**
+ * Simple CDI deployment.
+ *
+ * For internal use only with tests etc. Does not initialize/deploy the CDI container.
+ *
+ * @author tom.fennelly@gmail.com
+ */
+public class SimpleCDIDeployment extends AbstractDeployment {
+
+ private boolean _activateBeans = false;
+
+ /**
+ * Creates a new CDI deployment with no configuration.
+ */
+ public SimpleCDIDeployment() {
+ super(null);
+ }
+
+ @Override
+ protected void doInit(List activators) {
+ for (Activator activator : activators) {
+ if (activator.getActivationTypes().contains(BeanComponentActivator.BEAN_TYPE)) {
+ _activateBeans = true;
+ return;
+ }
+ }
+ }
+
+ @Override
+ public void start() {
+ BeanDeploymentMetaData beanDeploymentMetaData = BeanDeploymentMetaData.lookupBeanDeploymentMetaData();
+ deployTransformers(beanDeploymentMetaData, getDomain());
+ deployServicesAndProxies(beanDeploymentMetaData, getDomain());
+ }
+
+ @Override
+ public void stop() {
+ }
+
+ @Override
+ public void destroy() {
+ }
+
+ private void deployTransformers(BeanDeploymentMetaData beanDeploymentMetaData, ServiceDomain domain) {
+ TransformerRegistry transformerRegistry = domain.getTransformerRegistry();
+
+ for (CDIBean deploymentBean : beanDeploymentMetaData.getDeploymentBeans()) {
+ Class> beanClass = deploymentBean.getBean().getBeanClass();
+
+ if (TransformerUtil.isTransformer(beanClass)) {
+ List transformers = TransformerUtil.listTransformations(beanClass);
+ for (TransformerTypes transformer : transformers) {
+ transformerRegistry.addTransformer(TransformerUtil.newTransformer(beanClass,
+ transformer.getFrom(), transformer.getTo()));
+ }
+ }
+ }
+ }
+
+ private void deployServicesAndProxies(BeanDeploymentMetaData beanDeploymentMetaData, ServiceDomain domain) {
+ if (!_activateBeans) {
+ return;
+ }
+
+ if (beanDeploymentMetaData == null) {
+ throw BeanMessages.MESSAGES.failedToLookupBeanDeploymentMetaDataFromNamingContext();
+ }
+
+ BeanComponentActivator activator = new BeanComponentActivator();
+
+ for (ServiceDescriptor serviceDescriptor : beanDeploymentMetaData.getServiceDescriptors()) {
+ String serviceName = serviceDescriptor.getServiceName();
+ ServiceProxyHandler handler = serviceDescriptor.getHandler();
+ ServiceInterface serviceInterface;
+ ServiceReference service;
+
+ activator.lookupBeanMetaData();
+ serviceInterface = activator.buildServiceInterface(serviceName);
+ QName serviceQName = XMLHelper.createQName(domain.getName().getNamespaceURI(), serviceName);
+ domain.registerService(serviceQName, serviceInterface, handler);
+ service = domain.registerServiceReference(serviceQName, serviceInterface);
+ handler.addReference(service);
+ handler.start();
+
+ }
+ }
+
+ @Override
+ public Lifecycle getGatwayLifecycle(QName serviceName, String bindingName) {
+ return null;
+ }
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/internal/context/ContextBean.java b/components/bean/src/main/java/org/switchyard/component/bean/internal/context/ContextBean.java
new file mode 100644
index 000000000..767693b05
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/internal/context/ContextBean.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bean.internal.context;
+
+import org.switchyard.Context;
+import org.switchyard.component.bean.internal.InternalBean;
+
+/**
+ * Context Bean.
+ *
+ * CDI bean for injecting the SwitchYard Context into consumer beans.
+ *
+ * @author tom.fennelly@gmail.com
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+public class ContextBean extends InternalBean {
+
+ /**
+ * Public constructor.
+ */
+ public ContextBean() {
+ super(new ContextProxy(), Context.class);
+ }
+
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/internal/context/ContextProxy.java b/components/bean/src/main/java/org/switchyard/component/bean/internal/context/ContextProxy.java
new file mode 100644
index 000000000..86f56429f
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/internal/context/ContextProxy.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.internal.context;
+
+import java.util.Set;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Alternative;
+
+import org.switchyard.Context;
+import org.switchyard.Property;
+import org.switchyard.Scope;
+import org.switchyard.component.bean.BeanMessages;
+
+/**
+ * SwitchYard Context proxy.
+ *
+ * Injection is managed through ContextBean.
+ *
+ * @author tom.fennelly@gmail.com
+ */
+@ApplicationScoped
+@Alternative
+public class ContextProxy implements Context {
+
+ private static final ThreadLocal CONTEXT = new ThreadLocal();
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Property getProperty(String name) {
+ return getContext().getProperty(name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Property getProperty(String name, Scope scope) {
+ return getContext().getProperty(name, scope);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public T getPropertyValue(String name) {
+ return getContext().getPropertyValue(name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set getProperties() {
+ return getContext().getProperties();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set getProperties(Scope scope) {
+ return getContext().getProperties(scope);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void removeProperty(Property property) {
+ getContext().removeProperty(property);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void removeProperties() {
+ getContext().removeProperties();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void removeProperties(Scope scope) {
+ getContext().removeProperties(scope);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Property setProperty(String name, Object val) {
+ return getContext().setProperty(name, val);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Property setProperty(String name, Object val, Scope scope) {
+ return getContext().setProperty(name, val, scope);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Context setProperties(Set properties) {
+ return getContext().setProperties(properties);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void mergeInto(Context context) {
+ getContext().mergeInto(context);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set getProperties(String label) {
+ return getContext().getProperties(label);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void removeProperties(String label) {
+ getContext().removeProperties(label);
+ }
+
+ /**
+ * Gets the {@link Context} for the current thread.
+ * @return the context
+ */
+ private static Context getContext() {
+ Context context = CONTEXT.get();
+ if (context == null) {
+ throw BeanMessages.MESSAGES.illegalCallToGetTheSwitchYardContextMustBeCalledWithinTheExecutionOfAnExchangeHandlerChain();
+ }
+ return context;
+ }
+
+ /**
+ * Sets the {@link Context} for the current thread.
+ * @param context the context
+ */
+ public static void setContext(Context context) {
+ if (context != null) {
+ CONTEXT.set(context);
+ } else {
+ CONTEXT.remove();
+ }
+ }
+
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/internal/exchange/ExchangeBean.java b/components/bean/src/main/java/org/switchyard/component/bean/internal/exchange/ExchangeBean.java
new file mode 100644
index 000000000..979a76ad2
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/internal/exchange/ExchangeBean.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bean.internal.exchange;
+
+import org.switchyard.Exchange;
+import org.switchyard.component.bean.internal.InternalBean;
+
+/**
+ * Exchange Bean.
+ *
+ * CDI bean for injecting the SwitchYard Exchange into service beans.
+ */
+public class ExchangeBean extends InternalBean {
+
+ /**
+ * Public constructor.
+ */
+ public ExchangeBean() {
+ super(new ExchangeProxy(), Exchange.class);
+ }
+
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/internal/exchange/ExchangeProxy.java b/components/bean/src/main/java/org/switchyard/component/bean/internal/exchange/ExchangeProxy.java
new file mode 100644
index 000000000..e53fecaae
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/internal/exchange/ExchangeProxy.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bean.internal.exchange;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Alternative;
+
+import org.switchyard.Context;
+import org.switchyard.Exchange;
+import org.switchyard.ExchangeHandler;
+import org.switchyard.ExchangePattern;
+import org.switchyard.ExchangePhase;
+import org.switchyard.ExchangeSecurity;
+import org.switchyard.ExchangeState;
+import org.switchyard.Message;
+import org.switchyard.Service;
+import org.switchyard.ServiceReference;
+import org.switchyard.component.bean.BeanMessages;
+import org.switchyard.metadata.ExchangeContract;
+import org.switchyard.metadata.ServiceOperation;
+
+/**
+ * SwitchYard Exchange proxy.
+ *
+ * Injection is managed through ExchangeBean
+ */
+@ApplicationScoped
+@Alternative
+public class ExchangeProxy implements Exchange {
+
+ private static final ThreadLocal EXCHANGE = new ThreadLocal();
+
+ /**
+ * Gets the {@link Exchange} for the current thread.
+ * @return the message
+ */
+ private static Exchange getExchange() {
+ Exchange exchange = EXCHANGE.get();
+ if (exchange == null) {
+ throw BeanMessages.MESSAGES.illegalExchangeAccessOutsideHandlerChain();
+ }
+ return exchange;
+ }
+
+ /**
+ * Sets the {@link Exchange} for the current thread.
+ * @param exchange the exchange
+ */
+ public static void setExchange(Exchange exchange) {
+ if (exchange != null) {
+ EXCHANGE.set(exchange);
+ } else {
+ EXCHANGE.remove();
+ }
+ }
+
+ @Override
+ public Context getContext() {
+ return getExchange().getContext();
+ }
+
+ @Override
+ public Context getContext(Message message) {
+ return getExchange().getContext(message);
+ }
+
+ @Override
+ public ServiceReference getConsumer() {
+ return getExchange().getConsumer();
+ }
+
+ @Override
+ public Service getProvider() {
+ return getExchange().getProvider();
+ }
+
+ @Override
+ public ExchangeContract getContract() {
+ return getExchange().getContract();
+ }
+
+ @Override
+ public Exchange consumer(ServiceReference consumer, ServiceOperation operation) {
+ // ignore calls to consumer() as this is not supported after an exchange has been sent
+ return this;
+ }
+
+ @Override
+ public Exchange provider(Service provider, ServiceOperation operation) {
+ // ignore calls to provider() as this is not supported after an exchange has been sent
+ return this;
+ }
+
+ @Override
+ public Message getMessage() {
+ return getExchange().getMessage();
+ }
+
+ @Override
+ public Message createMessage() {
+ return getExchange().createMessage();
+ }
+
+ @Override
+ public void send(Message message) {
+ getExchange().send(message);
+ }
+
+ @Override
+ public void sendFault(Message message) {
+ getExchange().sendFault(message);
+ }
+
+ @Override
+ public ExchangeState getState() {
+ return getExchange().getState();
+ }
+
+ @Override
+ public ExchangePhase getPhase() {
+ return getExchange().getPhase();
+ }
+
+ @Override
+ public ExchangeHandler getReplyHandler() {
+ return null;
+ }
+
+ @Override
+ public ExchangePattern getPattern() {
+ return getExchange().getPattern();
+ }
+
+ @Override
+ public ExchangeSecurity getSecurity() {
+ return getExchange().getSecurity();
+ }
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/internal/message/MessageBean.java b/components/bean/src/main/java/org/switchyard/component/bean/internal/message/MessageBean.java
new file mode 100644
index 000000000..6f8c2d400
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/internal/message/MessageBean.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bean.internal.message;
+
+import org.switchyard.Message;
+import org.switchyard.component.bean.internal.InternalBean;
+
+/**
+ * Message Bean.
+ *
+ * CDI bean for injecting the SwitchYard Message into consumer beans.
+ *
+ * @author tom.fennelly@gmail.com
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+public class MessageBean extends InternalBean {
+
+ /**
+ * Public constructor.
+ */
+ public MessageBean() {
+ super(new MessageProxy(), Message.class);
+ }
+
+}
diff --git a/components/bean/src/main/java/org/switchyard/component/bean/internal/message/MessageProxy.java b/components/bean/src/main/java/org/switchyard/component/bean/internal/message/MessageProxy.java
new file mode 100644
index 000000000..9b9de06ad
--- /dev/null
+++ b/components/bean/src/main/java/org/switchyard/component/bean/internal/message/MessageProxy.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bean.internal.message;
+
+import java.util.Map;
+
+import javax.activation.DataSource;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Alternative;
+
+import org.switchyard.Context;
+import org.switchyard.Message;
+import org.switchyard.component.bean.BeanMessages;
+
+/**
+ * SwitchYard Message proxy.
+ *
+ * Injection is managed through MessageBean.
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+@ApplicationScoped
+@Alternative
+public class MessageProxy implements Message {
+
+ private static final ThreadLocal MESSAGE = new ThreadLocal();
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Context getContext() {
+ return getMessage().getContext();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Message setContent(Object content) {
+ return getMessage().setContent(content);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getContent() {
+ return getMessage().getContent();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public T getContent(Class type) {
+ return getMessage().getContent(type);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Message addAttachment(String name, DataSource attachment) {
+ return getMessage().addAttachment(name, attachment);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public DataSource getAttachment(String name) {
+ return getMessage().getAttachment(name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void removeAttachment(String name) {
+ getMessage().removeAttachment(name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Map getAttachmentMap() {
+ return getMessage().getAttachmentMap();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Message copy() {
+ return getMessage().copy();
+ }
+
+ /**
+ * Gets the {@link Message} for the current thread.
+ * @return the message
+ */
+ private static Message getMessage() {
+ Message message = MESSAGE.get();
+ if (message == null) {
+ throw BeanMessages.MESSAGES.illegalCallToGetTheSwitchYardContextMustBeCalledWithinTheExecutionOfAnExchangeHandlerChain();
+ }
+ return message;
+ }
+
+ /**
+ * Sets the {@link Message} for the current thread.
+ * @param message the message
+ */
+ public static void setMessage(Message message) {
+ if (message != null) {
+ MESSAGE.set(message);
+ } else {
+ MESSAGE.remove();
+ }
+ }
+
+}
diff --git a/components/bean/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/components/bean/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
new file mode 100644
index 000000000..5362de103
--- /dev/null
+++ b/components/bean/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
@@ -0,0 +1 @@
+org.switchyard.component.bean.SwitchYardCDIServiceDiscovery
\ No newline at end of file
diff --git a/components/bean/src/main/resources/META-INF/services/org.switchyard.deploy.Component b/components/bean/src/main/resources/META-INF/services/org.switchyard.deploy.Component
new file mode 100644
index 000000000..35b2296c9
--- /dev/null
+++ b/components/bean/src/main/resources/META-INF/services/org.switchyard.deploy.Component
@@ -0,0 +1 @@
+org.switchyard.component.bean.deploy.BeanComponent
diff --git a/components/bean/src/main/resources/org/switchyard/component/bean/config/model/v1/bean_1_0.xsd b/components/bean/src/main/resources/org/switchyard/component/bean/config/model/v1/bean_1_0.xsd
new file mode 100644
index 000000000..5cf09cc7d
--- /dev/null
+++ b/components/bean/src/main/resources/org/switchyard/component/bean/config/model/v1/bean_1_0.xsd
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bean/src/main/resources/org/switchyard/component/bean/config/model/v1/bean_1_1.xsd b/components/bean/src/main/resources/org/switchyard/component/bean/config/model/v1/bean_1_1.xsd
new file mode 100644
index 000000000..b2f0fda53
--- /dev/null
+++ b/components/bean/src/main/resources/org/switchyard/component/bean/config/model/v1/bean_1_1.xsd
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bean/src/main/resources/org/switchyard/component/bean/config/model/v2/bean_2_0.xsd b/components/bean/src/main/resources/org/switchyard/component/bean/config/model/v2/bean_2_0.xsd
new file mode 100644
index 000000000..b7e282a13
--- /dev/null
+++ b/components/bean/src/main/resources/org/switchyard/component/bean/config/model/v2/bean_2_0.xsd
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bean/src/main/resources/org/switchyard/config/model/descriptor.properties b/components/bean/src/main/resources/org/switchyard/config/model/descriptor.properties
new file mode 100644
index 000000000..4c3f36111
--- /dev/null
+++ b/components/bean/src/main/resources/org/switchyard/config/model/descriptor.properties
@@ -0,0 +1,32 @@
+# Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+
+bean_1_0.section=urn:switchyard-component-bean:config
+bean_1_0.version=1.0
+bean_1_0.namespace=urn:switchyard-component-bean:config:1.0
+bean_1_0.schema=bean_1_0.xsd
+bean_1_0.location=/org/switchyard/component/bean/config/model/v1/
+bean_1_0.marshaller=org.switchyard.component.bean.config.model.v1.V1BeanMarshaller
+
+bean_1_1.section=urn:switchyard-component-bean:config
+bean_1_1.version=1.1
+bean_1_1.namespace=urn:switchyard-component-bean:config:1.1
+bean_1_1.schema=bean_1_1.xsd
+bean_1_1.location=/org/switchyard/component/bean/config/model/v1/
+bean_1_1.marshaller=org.switchyard.component.bean.config.model.v1.V1BeanMarshaller
+
+bean_2_0.section=urn:switchyard-component-bean:config
+bean_2_0.version=2.0
+bean_2_0.namespace=urn:switchyard-component-bean:config:2.0
+bean_2_0.schema=bean_2_0.xsd
+bean_2_0.location=/org/switchyard/component/bean/config/model/v2/
+bean_2_0.marshaller=org.switchyard.component.bean.config.model.v1.V1BeanMarshaller
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/config/model/BeanModelTests.java b/components/bean/src/test/java/org/switchyard/component/bean/config/model/BeanModelTests.java
new file mode 100644
index 000000000..1a96ae9f9
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/config/model/BeanModelTests.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.config.model;
+
+import java.io.StringReader;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.junit.Before;
+import org.junit.Test;
+import org.switchyard.common.io.pull.StringPuller;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.ModelPuller;
+import org.switchyard.config.model.composite.ComponentImplementationModel;
+import org.switchyard.config.model.composite.ComponentModel;
+import org.switchyard.config.model.composite.CompositeModel;
+import org.switchyard.config.model.switchyard.SwitchYardModel;
+
+/**
+ * BeanModelTests.
+ *
+ * @author David Ward <dward@jboss.org > (C) 2011 Red Hat Inc.
+ */
+public class BeanModelTests {
+
+ private static final String COMPLETE_XML = "/org/switchyard/component/bean/config/model/BeanModelTests-Complete.xml";
+
+ private ModelPuller _puller;
+
+ @Before
+ public void before() throws Exception {
+ _puller = new ModelPuller();
+ }
+
+ @Test
+ public void testReadComplete() throws Exception {
+ SwitchYardModel switchyard = _puller.pull(COMPLETE_XML, getClass());
+ CompositeModel composite = switchyard.getComposite();
+ ComponentModel component = composite.getComponents().get(0);
+ ComponentImplementationModel implementation = component.getImplementation();
+ Assert.assertTrue(implementation instanceof BeanComponentImplementationModel);
+ BeanComponentImplementationModel bci = (BeanComponentImplementationModel)implementation;
+ Assert.assertEquals("bean", bci.getType());
+ Assert.assertEquals("org.switchyard.example.m1app.SimpleBean", bci.getClazz());
+ Configuration config = bci.getModelConfiguration();
+ Assert.assertEquals("implementation.bean", config.getName());
+ QName qname = config.getQName();
+ Assert.assertEquals("urn:switchyard-component-bean:config:1.0", qname.getNamespaceURI());
+ Assert.assertEquals("implementation.bean", qname.getLocalPart());
+ }
+
+ @Test
+ public void testWriteComplete() throws Exception {
+ String old_xml = new StringPuller().pull(COMPLETE_XML, getClass());
+ SwitchYardModel switchyard = _puller.pull(new StringReader(old_xml));
+ String new_xml = switchyard.toString();
+ XMLUnit.setIgnoreWhitespace(true);
+ Diff diff = XMLUnit.compareXML(old_xml, new_xml);
+ Assert.assertTrue(diff.toString(), diff.identical());
+ }
+
+ @Test
+ public void testValidation() throws Exception {
+ SwitchYardModel switchyard = _puller.pull(COMPLETE_XML, getClass());
+ switchyard.assertModelValid();
+ }
+
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/config/model/BeanSwitchYardScannerTest.java b/components/bean/src/test/java/org/switchyard/component/bean/config/model/BeanSwitchYardScannerTest.java
new file mode 100644
index 000000000..5f04b78e3
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/config/model/BeanSwitchYardScannerTest.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.config.model;
+
+import java.io.File;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.switchyard.common.type.Classes;
+import org.switchyard.component.bean.Reference;
+import org.switchyard.component.bean.Service;
+import org.switchyard.component.bean.deploy.CDIBeanServiceDescriptorTest;
+import org.switchyard.component.bean.tests.BeanUTConstants;
+import org.switchyard.component.bean.tests.OneWay;
+import org.switchyard.component.bean.tests.ServiceWithReferenceBean;
+import org.switchyard.config.model.ScannerInput;
+import org.switchyard.config.model.composite.ComponentImplementationModel;
+import org.switchyard.config.model.composite.ComponentModel;
+import org.switchyard.config.model.composite.ComponentReferenceModel;
+import org.switchyard.config.model.switchyard.SwitchYardModel;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+public class BeanSwitchYardScannerTest {
+
+ private SwitchYardModel _scannedModel;
+ private BeanSwitchYardScanner _scanner;
+ private List _scannedURLs;
+
+ @Before
+ public void setUp() throws Exception {
+ _scanner = new BeanSwitchYardScanner();
+
+ // If running this test inside your IDE... you need to set the cwd to be the
+ // root of the bean module !!
+ _scannedURLs = new ArrayList();
+ _scannedURLs.add(new File("./target/test-classes").toURI().toURL());
+ }
+
+ @Test
+ public void test() throws Exception {
+ scan(new File("./target/test-classes").toURI().toURL());
+ List components = _scannedModel.getComposite().getComponents();
+ for(ComponentModel component : components) {
+ ComponentImplementationModel implementation = component.getImplementation();
+ Assert.assertTrue(implementation instanceof BeanComponentImplementationModel);
+ checkBeanModel((BeanComponentImplementationModel)implementation);
+ }
+ }
+
+ // Verify that the ConsumerBean reference is picked up by the scanner
+ @Test
+ public void checkReference() throws Exception {
+ scan(new File("./target/test-classes").toURI().toURL());
+ ComponentModel consumerBeanModel = null;
+ ComponentReferenceModel oneWayReference = null;
+
+ for (ComponentModel component : _scannedModel.getComposite().getComponents()) {
+ BeanComponentImplementationModel beanImp =
+ (BeanComponentImplementationModel)component.getImplementation();
+ if (ServiceWithReferenceBean.class.getName().equals(beanImp.getClazz())) {
+ consumerBeanModel = component;
+ break;
+ }
+ }
+ // If the bean wasn't found, then something is screwed up
+ Assert.assertNotNull(consumerBeanModel);
+ for (ComponentReferenceModel reference : consumerBeanModel.getReferences()) {
+ if (reference.getName().equals(OneWay.class.getSimpleName())) {
+ oneWayReference = reference;
+ }
+ }
+ // OneWay reference should have been picked up by scanner
+ Assert.assertNotNull(oneWayReference);
+ }
+
+ // verify an empty model is created
+ @Test
+ public void testEmptyScan() throws Exception {
+ scan();
+ Assert.assertNull("Composite element should not be created if no components were found.",
+ _scannedModel.getComposite());
+ }
+
+ private void checkBeanModel(BeanComponentImplementationModel model) throws ClassNotFoundException {
+ Class> serviceClass = Classes.forName(model.getClazz(), getClass());
+
+ Assert.assertFalse(serviceClass.isInterface());
+ Assert.assertFalse(Modifier.isAbstract(serviceClass.getModifiers()));
+ if (!serviceClass.isAnnotationPresent(Service.class)) {
+ boolean referencePresent = false;
+ for (Field f : serviceClass.getDeclaredFields()) {
+ if (f.isAnnotationPresent(Reference.class)) {
+ referencePresent = true;
+ break;
+ }
+ }
+ Assert.assertTrue("Bean classes without an @Service must have at least one @Reference", referencePresent);
+ }
+
+ }
+
+ // Takes a list of URLs to scan *instead* of what's defined in @Before.
+ private void scan(URL ... urls) throws Exception {
+ _scannedURLs.clear();
+ if (urls != null && urls.length > 0) {
+ _scannedURLs.addAll(Arrays.asList(urls));
+ }
+ ScannerInput input = new ScannerInput()
+ .setURLs(_scannedURLs)
+ .setExcludePackages(BeanUTConstants.BEAN_SCANNER_BLACK_LIST);
+ _scannedModel = _scanner.scan(input).getModel();
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/deploy/CDIBeanServiceDescriptorTest.java b/components/bean/src/test/java/org/switchyard/component/bean/deploy/CDIBeanServiceDescriptorTest.java
new file mode 100644
index 000000000..409554b92
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/deploy/CDIBeanServiceDescriptorTest.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.deploy;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.switchyard.component.bean.Service;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+public class CDIBeanServiceDescriptorTest {
+
+ @Test
+ public void test_IsInterface_OK() {
+ CDIBeanServiceDescriptor.getServiceInterface(XImpl.class);
+ }
+
+ @Test
+ public void test_OmmitInterface_OK() {
+ CDIBeanServiceDescriptor.getServiceInterface(ZImpl.class);
+ }
+
+ @Test
+ public void test_OmmitInterface_Fail_noInterface() {
+ try {
+ CDIBeanServiceDescriptor.getServiceInterface(TImpl.class);
+ } catch (RuntimeException e) {
+ String message = e.getMessage();
+ Assert.assertTrue(message.contains("SWITCHYARD030420"));
+ }
+ }
+
+ @Test
+ public void test_OmmitInterface_Fail_multipleInterfaces() {
+ try {
+ CDIBeanServiceDescriptor.getServiceInterface(UImpl.class);
+ } catch (RuntimeException e) {
+ String message = e.getMessage();
+ Assert.assertTrue(message.contains("SWITCHYARD030420"));
+ }
+ }
+
+ @Test
+ public void test_IsInterface_Fail() {
+ try {
+ CDIBeanServiceDescriptor.getServiceInterface(YImpl.class);
+ } catch (RuntimeException e) {
+ String message = e.getMessage();
+ Assert.assertTrue(message.contains("SWITCHYARD030421"));
+ }
+ }
+
+ @Service(X.class)
+ private class XImpl {
+ }
+ private interface X {
+ }
+ @Service(String.class)
+ private class YImpl {
+ }
+ @Service
+ private class ZImpl implements Z {
+ }
+ private interface Z {
+ }
+ @Service
+ private class TImpl {
+ }
+ @Service
+ private class UImpl implements U, Z {
+ }
+ private interface U {
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/exchange/ExchangeInjection.java b/components/bean/src/test/java/org/switchyard/component/bean/exchange/ExchangeInjection.java
new file mode 100644
index 000000000..918c65137
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/exchange/ExchangeInjection.java
@@ -0,0 +1,9 @@
+package org.switchyard.component.bean.exchange;
+
+public interface ExchangeInjection {
+
+ String injectionNotNull(String msg);
+ String correctMessage(String msg);
+ String sendReply(String msg);
+ String attachments(String msg);
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/exchange/ExchangeInjectionBean.java b/components/bean/src/test/java/org/switchyard/component/bean/exchange/ExchangeInjectionBean.java
new file mode 100644
index 000000000..0673760b1
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/exchange/ExchangeInjectionBean.java
@@ -0,0 +1,56 @@
+package org.switchyard.component.bean.exchange;
+
+import javax.activation.DataSource;
+import javax.inject.Inject;
+
+import org.junit.Assert;
+import org.switchyard.Exchange;
+import org.switchyard.Message;
+import org.switchyard.component.bean.Service;
+
+@Service(value = ExchangeInjection.class, name = "ExchangeInjectionService")
+public class ExchangeInjectionBean implements ExchangeInjection {
+
+ @Inject
+ private Exchange exchange;
+
+ @Override
+ public String injectionNotNull(String msg) {
+ Assert.assertNotNull(exchange);
+ return msg;
+ }
+
+ @Override
+ public String correctMessage(String msg) {
+ Assert.assertEquals(ExchangeInjectionTest.TEST_IN_CONTENT, msg);
+ Assert.assertEquals(ExchangeInjectionTest.TEST_IN_PROPERTY,
+ exchange.getContext().getPropertyValue(ExchangeInjectionTest.TEST_IN_PROPERTY));
+ return "";
+ }
+
+ @Override
+ public String sendReply(String msg) {
+ Message message = exchange.createMessage();
+ message.setContent(ExchangeInjectionTest.TEST_OUT_CONTENT);
+ message.getContext().setProperty(ExchangeInjectionTest.TEST_OUT_PROPERTY,
+ ExchangeInjectionTest.TEST_OUT_PROPERTY);
+ exchange.send(message);
+ return "THIS SHOULD NOT BE RETURNED AS MESSAGE CONTENT";
+ }
+
+ @Override
+ public String attachments(String msg) {
+ DataSource attachIn = exchange.getMessage().getAttachment(
+ ExchangeInjectionTest.TEST_IN_ATTACHMENT);
+ Assert.assertNotNull(attachIn);
+ Assert.assertEquals(ExchangeInjectionTest.TEST_IN_ATTACHMENT, attachIn.getName());
+ Message message = exchange.createMessage();
+ message.setContent(ExchangeInjectionTest.TEST_OUT_CONTENT);
+ message.addAttachment(ExchangeInjectionTest.TEST_OUT_ATTACHMENT,
+ new DummyDataSource(ExchangeInjectionTest.TEST_OUT_ATTACHMENT));
+ exchange.send(message);
+ return "";
+ }
+
+
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/exchange/ExchangeInjectionTest.java b/components/bean/src/test/java/org/switchyard/component/bean/exchange/ExchangeInjectionTest.java
new file mode 100644
index 000000000..42dae3375
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/exchange/ExchangeInjectionTest.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.exchange;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.activation.DataSource;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.switchyard.Exchange;
+import org.switchyard.Message;
+import org.switchyard.component.test.mixins.cdi.CDIMixIn;
+import org.switchyard.test.Invoker;
+import org.switchyard.test.MockHandler;
+import org.switchyard.test.ServiceOperation;
+import org.switchyard.test.SwitchYardRunner;
+import org.switchyard.test.SwitchYardTestCaseConfig;
+
+@RunWith(SwitchYardRunner.class)
+@SwitchYardTestCaseConfig(mixins = CDIMixIn.class)
+public class ExchangeInjectionTest {
+
+ public static final String TEST_IN_ATTACHMENT = "TestInAttachment";
+ public static final String TEST_OUT_ATTACHMENT = "TestOutAttachment";
+ public static final String TEST_IN_CONTENT = "TestInContent";
+ public static final String TEST_OUT_CONTENT = "TestOutContent";
+ public static final String TEST_IN_PROPERTY = "TestInProperty";
+ public static final String TEST_OUT_PROPERTY = "TestOutProperty";
+
+ @ServiceOperation("ExchangeInjectionService")
+ private Invoker invokerService;
+
+ @ServiceOperation("ExchangeInjectionService.sendReply")
+ private Invoker sendReply;
+
+ @ServiceOperation("ExchangeInjectionService.attachments")
+ private Invoker attachments;
+
+ @Test
+ public void injectionNotNull() {
+ invokerService.operation("injectionNotNull").sendInOnly("injectionNotNull");
+ }
+
+ @Test
+ public void correctMessage() {
+ invokerService
+ .property(TEST_IN_PROPERTY, TEST_IN_PROPERTY)
+ .operation("correctMessage")
+ .sendInOut(TEST_IN_CONTENT);
+ }
+
+ @Test
+ public void sendReply() throws Exception {
+ MockHandler handler = new MockHandler();
+ handler.setWaitTimeout(3000);
+ Exchange ex = sendReply.createExchange(handler);
+ ex.send(ex.createMessage().setContent(TEST_IN_CONTENT));
+ Assert.assertEquals(1, handler.waitForOKMessage().getMessages().size());
+ Assert.assertEquals(TEST_OUT_CONTENT,
+ handler.getMessages().poll().getMessage().getContent());
+ }
+
+ @Test
+ public void attachments() throws Exception {
+ MockHandler handler = new MockHandler();
+ handler.setWaitTimeout(3000);
+ Exchange ex = attachments.createExchange(handler);
+ ex.send(ex.createMessage()
+ .setContent(TEST_IN_CONTENT)
+ .addAttachment(TEST_IN_ATTACHMENT, new DummyDataSource(TEST_IN_ATTACHMENT)));
+ Assert.assertEquals(1, handler.waitForOKMessage().getMessages().size());
+ Message reply = handler.getMessages().poll().getMessage();
+ DataSource attachOut = reply.getAttachment(TEST_OUT_ATTACHMENT);
+ Assert.assertNotNull(attachOut);
+ Assert.assertEquals(TEST_OUT_ATTACHMENT, attachOut.getName());
+ }
+}
+
+class DummyDataSource implements DataSource {
+
+ private String _name;
+
+ public DummyDataSource(String name) {
+ _name = name;
+ }
+
+ @Override
+ public String getContentType() {
+ return "";
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ return _name;
+ }
+
+ @Override
+ public OutputStream getOutputStream() throws IOException {
+ return null;
+ }
+
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/includeexclude/BeanActivatorWithoutConfigExcludeTest.java b/components/bean/src/test/java/org/switchyard/component/bean/includeexclude/BeanActivatorWithoutConfigExcludeTest.java
new file mode 100644
index 000000000..055c88cb5
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/includeexclude/BeanActivatorWithoutConfigExcludeTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.includeexclude;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.switchyard.Service;
+import org.switchyard.ServiceDomain;
+import org.switchyard.ServiceReference;
+import org.switchyard.component.bean.deploy.BeanComponentActivator;
+import org.switchyard.internal.DomainImpl;
+import org.switchyard.test.SwitchYardRunner;
+import org.switchyard.test.SwitchYardTestCaseConfig;
+import org.switchyard.component.test.mixins.cdi.CDIMixIn;
+
+import javax.xml.namespace.QName;
+
+@RunWith(SwitchYardRunner.class)
+@SwitchYardTestCaseConfig(mixins = CDIMixIn.class, exclude = BeanComponentActivator.BEAN_TYPE)
+public class BeanActivatorWithoutConfigExcludeTest {
+
+ private ServiceDomain domain;
+
+ @Test
+ public void test() {
+ List services = ((DomainImpl)domain).getServiceRegistry().getServices(
+ QName.valueOf("ConsumerService"));
+ Assert.assertEquals(0, services.size());
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/includeexclude/BeanActivatorWithoutConfigIncludeTest.java b/components/bean/src/test/java/org/switchyard/component/bean/includeexclude/BeanActivatorWithoutConfigIncludeTest.java
new file mode 100644
index 000000000..331ca9ca6
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/includeexclude/BeanActivatorWithoutConfigIncludeTest.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.includeexclude;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.switchyard.Service;
+import org.switchyard.ServiceDomain;
+import org.switchyard.component.bean.deploy.BeanComponentActivator;
+import org.switchyard.internal.DomainImpl;
+import org.switchyard.test.SwitchYardRunner;
+import org.switchyard.test.SwitchYardTestCaseConfig;
+import org.switchyard.component.test.mixins.cdi.CDIMixIn;
+
+@RunWith(SwitchYardRunner.class)
+@SwitchYardTestCaseConfig(mixins = CDIMixIn.class, include = BeanComponentActivator.BEAN_TYPE)
+public class BeanActivatorWithoutConfigIncludeTest {
+
+ private ServiceDomain domain;
+
+ @Test
+ public void test() {
+ List services = ((DomainImpl)domain).getServiceRegistry().getServices(
+ QName.valueOf("ConsumerService"));
+ Assert.assertEquals(1, services.size());
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/inject/InjectService.java b/components/bean/src/test/java/org/switchyard/component/bean/inject/InjectService.java
new file mode 100644
index 000000000..138ab1ee8
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/inject/InjectService.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bean.inject;
+
+public interface InjectService {
+
+ public String doSomething(String in);
+
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/inject/InjectServiceImpl.java b/components/bean/src/test/java/org/switchyard/component/bean/inject/InjectServiceImpl.java
new file mode 100644
index 000000000..198f2741d
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/inject/InjectServiceImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bean.inject;
+
+import java.io.IOException;
+
+import javax.activation.DataSource;
+import javax.inject.Inject;
+
+import org.switchyard.Context;
+import org.switchyard.Message;
+import org.switchyard.common.io.pull.StringPuller;
+import org.switchyard.component.bean.Service;
+
+@Service(InjectService.class)
+public class InjectServiceImpl implements InjectService {
+
+ @Inject
+ private Context context;
+
+ @Inject
+ private Message message;
+
+ @Override
+ public String doSomething(String in) {
+ String propC = (String)context.getProperty("someProp").getValue();
+ String propM = (String)message.getContext().getProperty("someProp").getValue();
+ boolean propertyMatch = propC.equals(propM);
+ boolean contentMatch = in.equals(message.getContent(String.class));
+ DataSource attach = message.getAttachment("someAttach");
+ String attachData;
+ try {
+ attachData = new StringPuller().pull(attach.getInputStream());
+ } catch (IOException ioe) {
+ throw new RuntimeException(ioe);
+ }
+ boolean attachMatch = "someAttach".equals(attach.getName()) && "text/plain".equals(attach.getContentType()) && "someAttachData".equals(attachData);
+ return propertyMatch + ", " + contentMatch + ", " + attachMatch;
+ }
+
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/inject/InjectTest.java b/components/bean/src/test/java/org/switchyard/component/bean/inject/InjectTest.java
new file mode 100644
index 000000000..4eb127738
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/inject/InjectTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bean.inject;
+
+import javax.activation.DataSource;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.switchyard.Context;
+import org.switchyard.Exchange;
+import org.switchyard.Message;
+import org.switchyard.component.common.SynchronousInOutHandler;
+import org.switchyard.component.test.mixins.cdi.CDIMixIn;
+import org.switchyard.test.Invoker;
+import org.switchyard.test.SwitchYardRunner;
+import org.switchyard.test.SwitchYardTestCaseConfig;
+import org.switchyard.test.SwitchYardTestKit;
+import org.switchyard.test.TestDataSource;
+
+@RunWith(SwitchYardRunner.class)
+@SwitchYardTestCaseConfig(mixins = CDIMixIn.class)
+public class InjectTest {
+
+ private SwitchYardTestKit _testKit;
+
+ @Test
+ public void testInject() {
+ Invoker invoker = _testKit.newInvoker("InjectService.doSomething");
+ SynchronousInOutHandler handler = new SynchronousInOutHandler();
+ Exchange exchange = invoker.createExchange(handler);
+ Message message = exchange.createMessage();
+ Context context = exchange.getContext(message);
+ context.setProperty("someProp", "somePropVal");
+ message.setContent("blah");
+ DataSource attach = new TestDataSource("someAttach", "text/plain", "someAttachData");
+ message.addAttachment(attach.getName(), attach);
+ exchange.send(message);
+ Exchange outExchange = handler.waitForOut();
+ Assert.assertEquals("true, true, true", outExchange.getMessage().getContent());
+ }
+
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/invoker/DummyException.java b/components/bean/src/test/java/org/switchyard/component/bean/invoker/DummyException.java
new file mode 100644
index 000000000..d7db703ba
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/invoker/DummyException.java
@@ -0,0 +1,10 @@
+package org.switchyard.component.bean.invoker;
+
+public class DummyException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public DummyException(String msg) {
+ super(msg);
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/invoker/InvokerReferenceContract.java b/components/bean/src/test/java/org/switchyard/component/bean/invoker/InvokerReferenceContract.java
new file mode 100644
index 000000000..5410206c4
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/invoker/InvokerReferenceContract.java
@@ -0,0 +1,9 @@
+package org.switchyard.component.bean.invoker;
+
+public interface InvokerReferenceContract {
+
+ void inOnly(String msg);
+ String inOut(String msg);
+ String declaredException(String msg) throws DummyException;
+ String undeclaredException(String msg);
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/invoker/InvokerServiceContract.java b/components/bean/src/test/java/org/switchyard/component/bean/invoker/InvokerServiceContract.java
new file mode 100644
index 000000000..966f3187e
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/invoker/InvokerServiceContract.java
@@ -0,0 +1,15 @@
+package org.switchyard.component.bean.invoker;
+
+public interface InvokerServiceContract {
+
+ void testA(String msg);
+ void testB(String msg);
+ void testZ(String msg);
+ void propertyTest(String msg);
+ void noOperation(String msg);
+ void getContract(String msg);
+ void invokeWithContent(String msg);
+ void messageTest(String msg);
+ void declaredException(String msg);
+ void undeclaredException(String msg);
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/invoker/ReferenceInvokerBean.java b/components/bean/src/test/java/org/switchyard/component/bean/invoker/ReferenceInvokerBean.java
new file mode 100644
index 000000000..0f6b1ecdd
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/invoker/ReferenceInvokerBean.java
@@ -0,0 +1,136 @@
+package org.switchyard.component.bean.invoker;
+
+import javax.inject.Inject;
+
+import org.junit.Assert;
+import org.switchyard.component.bean.Reference;
+import org.switchyard.component.bean.ReferenceInvocation;
+import org.switchyard.component.bean.ReferenceInvoker;
+import org.switchyard.component.bean.Service;
+import org.switchyard.extensions.java.JavaService;
+
+@Service(value = InvokerServiceContract.class, name = "InvokerService")
+public class ReferenceInvokerBean implements InvokerServiceContract {
+
+ @Inject @Reference(ReferenceInvokerTest.REFERENCE_A)
+ private ReferenceInvoker invokerA;
+
+ @Inject @Reference(ReferenceInvokerTest.REFERENCE_B)
+ private ReferenceInvoker invokerB;
+
+ @Inject @Reference("ThisReferenceDoesNotExist")
+ private ReferenceInvoker invokerZ;
+
+ @Override
+ public void testA(String msg) {
+ try {
+ invokerA.newInvocation("inOnly").invoke();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+ @Override
+ public void testB(String msg) {
+ try {
+ invokerB.newInvocation("inOnly").invoke();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+ @Override
+ public void testZ(String msg) {
+ try {
+ invokerZ.newInvocation("inOnly").invoke();
+ Assert.fail("Should not be able to invoke a service without a component reference");
+ } catch (Exception ex) {
+ Assert.assertTrue(ex instanceof IllegalStateException);
+ System.out.println("Expected exception caught with missing reference:\n\t" + ex.getMessage());
+ }
+ }
+
+ @Override
+ public void propertyTest(String msg) {
+ try {
+ ReferenceInvocation invoke = invokerA.newInvocation("inOut")
+ .setProperty(ReferenceInvokerTest.TEST_IN_PROPERTY, ReferenceInvokerTest.TEST_IN_PROPERTY)
+ .invoke();
+
+ // check that the out property can be read from the context
+ Object outProp = invoke.getProperty(ReferenceInvokerTest.TEST_OUT_PROPERTY);
+ Assert.assertNotNull(outProp);
+ Assert.assertEquals(ReferenceInvokerTest.TEST_OUT_PROPERTY, outProp);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+ @Override
+ public void messageTest(String msg) {
+ try {
+ ReferenceInvocation invoker = invokerA.newInvocation("inOut");
+ invoker.getMessage().setContent("message-test-in");
+ invoker.invoke();
+
+ // check that the correct message reference is returned from invoke
+ Assert.assertNotNull(invoker.getMessage().getContent());
+ Assert.assertEquals("message-test-out", invoker.getMessage().getContent());
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+ @Override
+ public void invokeWithContent(String msg) {
+ try {
+ invokerA.newInvocation("inOnly").invoke("content-test-in");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+ @Override
+ public void noOperation(String msg) {
+ try {
+ invokerA.newInvocation().invoke();
+ Assert.fail("Should not be able to invoke a service with multiple operations without specifying op name");
+ } catch (Exception ex) {
+ Assert.assertTrue(ex instanceof IllegalStateException);
+ System.out.println("Expected exception caught when operation name not specified:\n\t" + ex.getMessage());
+ }
+ }
+
+ @Override
+ public void getContract(String msg) {
+ Assert.assertEquals(invokerA.getContract().getType(), JavaService.TYPE);
+ Assert.assertEquals(((JavaService)invokerA.getContract()).getJavaInterface(), InvokerReferenceContract.class);
+ }
+
+ @Override
+ public void declaredException(String msg) {
+ try {
+ invokerA.newInvocation("declaredException").invoke();
+ Assert.fail("Fault returned on reference invocation not thrown as exception");
+ } catch (Exception ex) {
+ Assert.assertTrue(ex instanceof DummyException);
+ }
+ }
+
+ @Override
+ public void undeclaredException(String msg) {
+ try {
+ invokerA.newInvocation("undeclaredException").invoke();
+ Assert.fail();
+ } catch (Exception ex) {
+ Assert.assertTrue(ex instanceof DummyException);
+ }
+ }
+
+
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/invoker/ReferenceInvokerTest.java b/components/bean/src/test/java/org/switchyard/component/bean/invoker/ReferenceInvokerTest.java
new file mode 100644
index 000000000..a7c3eaece
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/invoker/ReferenceInvokerTest.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.invoker;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.switchyard.BaseHandler;
+import org.switchyard.Exchange;
+import org.switchyard.HandlerException;
+import org.switchyard.Message;
+import org.switchyard.Property;
+import org.switchyard.Scope;
+import org.switchyard.component.test.mixins.cdi.CDIMixIn;
+import org.switchyard.test.Invoker;
+import org.switchyard.test.MockHandler;
+import org.switchyard.test.ServiceOperation;
+import org.switchyard.test.SwitchYardRunner;
+import org.switchyard.test.SwitchYardTestCaseConfig;
+import org.switchyard.test.SwitchYardTestKit;
+
+@RunWith(SwitchYardRunner.class)
+@SwitchYardTestCaseConfig(config = "ReferenceInvokerTest.xml", mixins = CDIMixIn.class)
+public class ReferenceInvokerTest {
+
+ public static final String REFERENCE_A = "ReferenceA";
+ public static final String REFERENCE_B = "ReferenceB";
+ public static final String TEST_IN_PROPERTY = "TestInProperty";
+ public static final String TEST_OUT_PROPERTY = "TestOutProperty";
+ private SwitchYardTestKit testKit;
+
+ @ServiceOperation("InvokerService")
+ private Invoker invokerService;
+
+ @Test
+ public void invokeReferenceA() {
+ MockHandler handlerA = testKit.registerInOnlyService(REFERENCE_A);
+ MockHandler handlerB = testKit.registerInOnlyService(REFERENCE_B);
+ invokerService.operation("testA").sendInOut("testA");
+ Assert.assertEquals(1, handlerA.getMessages().size());
+ Assert.assertEquals(0, handlerB.getMessages().size());
+ }
+
+ @Test
+ public void invokeReferenceB() {
+ MockHandler handlerA = testKit.registerInOnlyService(REFERENCE_A);
+ MockHandler handlerB = testKit.registerInOnlyService(REFERENCE_B);
+ invokerService.operation("testB").sendInOut("testB");
+ Assert.assertEquals(0, handlerA.getMessages().size());
+ Assert.assertEquals(1, handlerB.getMessages().size());
+ }
+
+ @Test
+ public void invokeNonexistentReference() {
+ invokerService.operation("testZ").sendInOut("testZ");
+ }
+
+ @Test
+ public void invokeWithoutOperationName() {
+ invokerService.operation("noOperation").sendInOut("noOperation");
+ }
+
+ @Test
+ public void getContract() {
+ invokerService.operation("getContract").sendInOut("getContract");
+ }
+
+ @Test
+ public void messageTest() {
+ testKit.registerInOutService(REFERENCE_A, new BaseHandler() {
+ @Override
+ public void handleMessage(Exchange exchange) throws HandlerException {
+ // Verify that the content was set on the request message by the invoker
+ Assert.assertNotNull(exchange.getMessage().getContent());
+ Assert.assertEquals("message-test-in", exchange.getMessage().getContent());
+
+ // Set out content to be returned through invoker
+ Message reply = exchange.createMessage();
+ reply.setContent("message-test-out");
+ exchange.send(reply);
+ }
+ });
+ invokerService.operation("messageTest").sendInOut("messageTest");
+ }
+
+ @Test
+ public void invokeWithContent() {
+ testKit.registerInOutService(REFERENCE_A, new BaseHandler() {
+ @Override
+ public void handleMessage(Exchange exchange) throws HandlerException {
+ // Verify that the content was set on the request message by the invoker
+ Assert.assertNotNull(exchange.getMessage().getContent());
+ Assert.assertEquals("content-test-in", exchange.getMessage().getContent());
+ }
+ });
+ invokerService.operation("invokeWithContent").sendInOut("invokeWithContent");
+ }
+
+ @Test
+ public void setProperty() {
+ testKit.registerInOutService(REFERENCE_A, new BaseHandler() {
+ @Override
+ public void handleMessage(Exchange exchange) throws HandlerException {
+ // Verify that a property was set on the request message by the invoker
+ Property inProp = exchange.getContext(exchange.getMessage())
+ .getProperty(TEST_IN_PROPERTY, Scope.MESSAGE);
+ Assert.assertNotNull(inProp);
+ Assert.assertEquals(TEST_IN_PROPERTY, inProp.getValue());
+
+ // Set an out property which will be verified in the test bean class
+ Message reply = exchange.createMessage();
+ exchange.getContext(reply)
+ .setProperty(TEST_OUT_PROPERTY, TEST_OUT_PROPERTY, Scope.MESSAGE);
+ exchange.send(reply);
+ }
+ });
+ invokerService.operation("propertyTest").sendInOut("propertyTest");
+ }
+
+ @Test
+ public void declaredException() {
+ testKit.registerInOutService(REFERENCE_A, new BaseHandler() {
+ public void handleMessage(Exchange exchange) throws HandlerException {
+ Message reply = exchange.createMessage();
+ reply.setContent(new DummyException(
+ exchange.getMessage().getContent(String.class)));
+ exchange.sendFault(reply);
+ }
+ });
+ invokerService.operation("declaredException").sendInOut("declaredException");
+ }
+
+ @Test
+ public void undeclaredException() {
+ testKit.registerInOutService(REFERENCE_A, new BaseHandler() {
+ public void handleMessage(Exchange exchange) throws HandlerException {
+ throw new HandlerException(new DummyException(
+ exchange.getMessage().getContent(String.class)));
+ }
+ });
+ invokerService.operation("undeclaredException").sendInOut("undeclaredException");
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/InventoryClientService1.java b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/InventoryClientService1.java
new file mode 100644
index 000000000..8132db25c
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/InventoryClientService1.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.multiversionref;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+public interface InventoryClientService1 {
+
+ String doStuff(String input);
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/InventoryClientService1Bean.java b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/InventoryClientService1Bean.java
new file mode 100644
index 000000000..51a1e733e
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/InventoryClientService1Bean.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.multiversionref;
+
+import org.switchyard.component.bean.Reference;
+import org.switchyard.component.bean.Service;
+import org.switchyard.component.bean.multiversionref.oldinvservice.A;
+import org.switchyard.component.bean.multiversionref.oldinvservice.OldInventoryService;
+
+import javax.inject.Inject;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+@Service(InventoryClientService1.class)
+public class InventoryClientService1Bean implements InventoryClientService1 {
+
+ @Inject @Reference("InventoryService")
+ private OldInventoryService oldInventoryService;
+
+ @Override
+ public String doStuff(String input) {
+ A result = oldInventoryService.getInventory(new A());
+ return "old";
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/InventoryClientService2.java b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/InventoryClientService2.java
new file mode 100644
index 000000000..100ece759
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/InventoryClientService2.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.multiversionref;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+public interface InventoryClientService2 {
+
+ String doStuff(String input);
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/InventoryClientService2Bean.java b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/InventoryClientService2Bean.java
new file mode 100644
index 000000000..c94b59ac8
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/InventoryClientService2Bean.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.multiversionref;
+
+import org.switchyard.component.bean.Reference;
+import org.switchyard.component.bean.Service;
+import org.switchyard.component.bean.multiversionref.newinvservice.B;
+import org.switchyard.component.bean.multiversionref.newinvservice.InventoryService;
+
+import javax.inject.Inject;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+@Service(InventoryClientService2.class)
+public class InventoryClientService2Bean implements InventoryClientService2 {
+
+ @Inject @Reference("InventoryService")
+ private InventoryService newInventoryService;
+
+ @Override
+ public String doStuff(String input) {
+ B result = newInventoryService.getInventory(new B());
+ return "new";
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/MultiVersionServiceTest.java b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/MultiVersionServiceTest.java
new file mode 100644
index 000000000..4e73723c3
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/MultiVersionServiceTest.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.multiversionref;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.switchyard.test.Invoker;
+import org.switchyard.test.ServiceOperation;
+import org.switchyard.test.SwitchYardRunner;
+import org.switchyard.test.SwitchYardTestCaseConfig;
+import org.switchyard.component.test.mixins.cdi.CDIMixIn;
+
+/**
+ * This test is testing checking that @Referenced services can be invoked
+ * through old and new interfaces and that the appropriate input/output
+ * parameter transformations are automatically applied based on the ExchangeContract
+ * information specified in the ClientBeanProxyHandler.
+ *
+ * InventoryClientService1 uses the old inventory interface to invoke the inventory service,
+ * while InventoryClientService2 uses the new inventory interface. In both cases, they are
+ * invoking the same backend service (the new version). SwitchYard ensures that the appropriate
+ * type transformation happen for InventoryClientService1.
+ *
+ * @author tom.fennelly@gmail.com
+ */
+@RunWith(SwitchYardRunner.class)
+@SwitchYardTestCaseConfig(mixins = CDIMixIn.class)
+public class MultiVersionServiceTest {
+
+ @ServiceOperation("InventoryClientService1.doStuff")
+ private Invoker doStuffOp1;
+
+ @ServiceOperation("InventoryClientService2.doStuff")
+ private Invoker doStuffOp2;
+
+ @Test
+ public void test_InventoryClientService1() {
+ String response = doStuffOp1.sendInOut("hello").getContent(String.class);
+
+ Assert.assertEquals("old", response);
+ }
+
+ @Test
+ public void test_InventoryClientService2() {
+ String response = doStuffOp2.sendInOut("hello").getContent(String.class);
+
+ Assert.assertEquals("new", response);
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/newinvservice/B.java b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/newinvservice/B.java
new file mode 100644
index 000000000..2da41af98
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/newinvservice/B.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.multiversionref.newinvservice;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+public class B {
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/newinvservice/InventoryService.java b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/newinvservice/InventoryService.java
new file mode 100644
index 000000000..55ba4d15f
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/newinvservice/InventoryService.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.multiversionref.newinvservice;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+public interface InventoryService {
+
+ B getInventory(B b);
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/newinvservice/NewInventoryServiceBean.java b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/newinvservice/NewInventoryServiceBean.java
new file mode 100644
index 000000000..69ce758af
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/newinvservice/NewInventoryServiceBean.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.multiversionref.newinvservice;
+
+import org.switchyard.component.bean.Service;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+@Service(InventoryService.class)
+public class NewInventoryServiceBean implements InventoryService {
+
+ @Override
+ public B getInventory(B b) {
+ return b;
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/newinvservice/Transformers.java b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/newinvservice/Transformers.java
new file mode 100644
index 000000000..57b600872
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/newinvservice/Transformers.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.multiversionref.newinvservice;
+
+import org.switchyard.annotations.Transformer;
+import org.switchyard.component.bean.multiversionref.oldinvservice.A;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+public class Transformers {
+
+ @Transformer
+ public B transformA2B(A a) {
+ return new B();
+ }
+
+ @Transformer
+ public A transformB2A(B b) {
+ return new A();
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/oldinvservice/A.java b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/oldinvservice/A.java
new file mode 100644
index 000000000..51123eb7f
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/oldinvservice/A.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.multiversionref.oldinvservice;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+public class A {
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/oldinvservice/OldInventoryService.java b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/oldinvservice/OldInventoryService.java
new file mode 100644
index 000000000..6d73d7776
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/multiversionref/oldinvservice/OldInventoryService.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.multiversionref.oldinvservice;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+public interface OldInventoryService {
+
+ A getInventory(A a);
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/omservice/basic/BasicInOutTest.java b/components/bean/src/test/java/org/switchyard/component/bean/omservice/basic/BasicInOutTest.java
new file mode 100644
index 000000000..a778df2b9
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/omservice/basic/BasicInOutTest.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.omservice.basic;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.switchyard.Message;
+import org.switchyard.component.bean.omservice.model.OrderRequest;
+import org.switchyard.component.bean.omservice.model.OrderResponse;
+import org.switchyard.test.SwitchYardTestCaseConfig;
+import org.switchyard.test.SwitchYardRunner;
+import org.switchyard.test.SwitchYardTestKit;
+import org.switchyard.component.test.mixins.cdi.CDIMixIn;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+@RunWith(SwitchYardRunner.class)
+@SwitchYardTestCaseConfig(mixins = CDIMixIn.class)
+public class BasicInOutTest {
+
+ private SwitchYardTestKit _testKit;
+
+ @Test
+ public void test_New_Way() {
+
+ Message responseMsg = _testKit.newInvoker("BasicOrderManagementService.createOrder").
+ sendInOut(new OrderRequest("D123", "ABCD"));
+
+ OrderResponse response = (OrderResponse) responseMsg.getContent();
+
+ Assert.assertEquals("D123", response.orderId);
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/omservice/basic/BasicOrderManagementService.java b/components/bean/src/test/java/org/switchyard/component/bean/omservice/basic/BasicOrderManagementService.java
new file mode 100644
index 000000000..d36e88aec
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/omservice/basic/BasicOrderManagementService.java
@@ -0,0 +1,11 @@
+package org.switchyard.component.bean.omservice.basic;
+
+import org.switchyard.component.bean.omservice.model.OrderRequest;
+import org.switchyard.component.bean.omservice.model.OrderResponse;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+public interface BasicOrderManagementService {
+ OrderResponse createOrder(OrderRequest request);
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/omservice/basic/BasicOrderManagementServiceImpl.java b/components/bean/src/test/java/org/switchyard/component/bean/omservice/basic/BasicOrderManagementServiceImpl.java
new file mode 100644
index 000000000..213496b9d
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/omservice/basic/BasicOrderManagementServiceImpl.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.omservice.basic;
+
+import org.switchyard.component.bean.Service;
+import org.switchyard.component.bean.omservice.model.OrderRequest;
+import org.switchyard.component.bean.omservice.model.OrderResponse;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+@Service(BasicOrderManagementService.class)
+public class BasicOrderManagementServiceImpl implements BasicOrderManagementService {
+
+ @Override
+ public OrderResponse createOrder(OrderRequest request) {
+
+ return new OrderResponse(request.orderId);
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/omservice/model/OrderRequest.java b/components/bean/src/test/java/org/switchyard/component/bean/omservice/model/OrderRequest.java
new file mode 100644
index 000000000..5bdca2603
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/omservice/model/OrderRequest.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.omservice.model;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+public class OrderRequest {
+
+ public String orderId;
+ public String productId;
+
+ public OrderRequest() {
+ }
+
+ public OrderRequest(String orderId, String productId) {
+ this.orderId = orderId;
+ this.productId = productId;
+ }
+
+ public String getOrderId() {
+ return orderId;
+ }
+
+ public void setOrderId(String orderId) {
+ this.orderId = orderId;
+ }
+
+ public String getProductId() {
+ return productId;
+ }
+
+ public void setProductId(String productId) {
+ this.productId = productId;
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/omservice/model/OrderResponse.java b/components/bean/src/test/java/org/switchyard/component/bean/omservice/model/OrderResponse.java
new file mode 100644
index 000000000..c2cd044e8
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/omservice/model/OrderResponse.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.omservice.model;
+
+import org.switchyard.component.bean.prodservice.Product;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+public class OrderResponse {
+
+ public String orderId;
+ public Product product;
+
+ public OrderResponse() {
+ }
+
+ public OrderResponse(String orderId) {
+ this.orderId = orderId;
+ }
+
+ public String getOrderId() {
+ return orderId;
+ }
+
+ public void setOrderId(String orderId) {
+ this.orderId = orderId;
+ }
+
+ public Product getProduct() {
+ return product;
+ }
+
+ public void setProduct(Product product) {
+ this.product = product;
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/prodservice/Product.java b/components/bean/src/test/java/org/switchyard/component/bean/prodservice/Product.java
new file mode 100644
index 000000000..7884deb08
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/prodservice/Product.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.prodservice;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+public class Product {
+
+ public String id;
+ public String name;
+
+ public Product() {
+ }
+
+ public Product(String id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/prodservice/ProductService.java b/components/bean/src/test/java/org/switchyard/component/bean/prodservice/ProductService.java
new file mode 100644
index 000000000..d0109c3d4
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/prodservice/ProductService.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.prodservice;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+public interface ProductService {
+
+ Product getProduct(String productId);
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/prodservice/ProductServiceImpl.java b/components/bean/src/test/java/org/switchyard/component/bean/prodservice/ProductServiceImpl.java
new file mode 100644
index 000000000..0f981bcda
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/prodservice/ProductServiceImpl.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.prodservice;
+
+import org.switchyard.component.bean.Service;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+@Service(ProductService.class)
+public class ProductServiceImpl implements ProductService {
+
+ public Product getProduct(String productId) {
+ return new Product(productId, "MacBook Pro");
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/BeanConsumerTest.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/BeanConsumerTest.java
new file mode 100644
index 000000000..3f3aeacef
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/BeanConsumerTest.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.switchyard.HandlerException;
+import org.switchyard.Message;
+import org.switchyard.component.bean.BeanComponentException;
+import org.switchyard.component.test.mixins.cdi.CDIMixIn;
+import org.switchyard.test.InvocationFaultException;
+import org.switchyard.test.Invoker;
+import org.switchyard.test.ServiceOperation;
+import org.switchyard.test.SwitchYardRunner;
+import org.switchyard.test.SwitchYardTestCaseConfig;
+
+/*
+ * Assorted methods for testing a CDI bean consuming a service in SwitchYard.
+ */
+@RunWith(SwitchYardRunner.class)
+@SwitchYardTestCaseConfig(mixins = CDIMixIn.class)
+public class BeanConsumerTest {
+
+ @ServiceOperation("ConsumerService.consumeInOnlyNoArgsService")
+ private Invoker inOnlyNoArgs;
+ @ServiceOperation("ConsumerService.consumeInOnlyService")
+ private Invoker inOnly;
+ @ServiceOperation("ConsumerService.consumeInOutService")
+ private Invoker inOut;
+ @ServiceOperation("ConsumerService.consumeInOutServiceThrowsRuntimeException")
+ private Invoker inOutRuntimeEx;
+ @ServiceOperation("ConsumerService.unknownXOp")
+ private Invoker unknownXOp;
+
+ @Test
+ public void consumeInOnlyServiceFromBean_without_args() {
+ inOnlyNoArgs.sendInOnly(null);
+ }
+
+ @Test
+ public void consumeInOnlyServiceFromBean_new_way() {
+ inOnly.sendInOnly("hello");
+ }
+
+ @Test
+ public void consumeInOutServiceFromBean_new_way() {
+ Message responseMsg = inOut.sendInOut("hello");
+
+ Assert.assertEquals("hello", responseMsg.getContent());
+ }
+
+ @Test
+ public void consumeInOnlyServiceFromBean_Fault_invalid_operation() {
+ try {
+ // this should result in a fault
+ unknownXOp.sendInOut("hello");
+ // if we got here, then our negative test failed
+ Assert.fail("Invalid operation allowed!");
+ } catch (InvocationFaultException ifEx) {
+ String msg = ifEx.getFaultMessage().getContent(Exception.class).getMessage();
+ Assert.assertTrue(msg.contains("SWITCHYARD014013"));
+ }
+ }
+
+ @Test
+ public void consumeInOutServiceFromBean_Fault_service_exception() {
+ try {
+ // this should result in a fault
+ inOut.sendInOut(new ConsumerException("throw me a remote exception please!!"));
+ // if we got here, then our negative test failed
+ Assert.fail("Exception thrown by bean but not turned into fault!");
+ } catch (InvocationFaultException infEx) {
+ System.out.println(infEx.getFaultMessage().getContent());
+ Message faultMsg = infEx.getFaultMessage();
+ Assert.assertTrue(faultMsg.getContent() instanceof ConsumerException);
+ Assert.assertEquals("remote-exception-received", faultMsg.getContent(ConsumerException.class).getMessage());
+ }
+ }
+
+ @Test
+ public void consumeInOutServiceFromBean_throws_runtime_exception() {
+ try {
+ // this should result in a fault
+ inOutRuntimeEx.sendInOut(new ConsumerException("throw me a remote exception please!!"));
+ // if we got here, then our negative test failed
+ Assert.fail("Exception thrown by bean but not turned into fault!");
+ } catch (InvocationFaultException infEx) {
+ System.out.println(infEx.getFaultMessage().getContent());
+ Message faultMsg = infEx.getFaultMessage();
+ Assert.assertTrue(faultMsg.getContent() instanceof HandlerException);
+ Assert.assertEquals("throw me a remote exception please!!", faultMsg.getContent(HandlerException.class).getCause().getCause().getMessage());
+ }
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/BeanPropertyTest.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/BeanPropertyTest.java
new file mode 100644
index 000000000..e8f2e7879
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/BeanPropertyTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.switchyard.test.Invoker;
+import org.switchyard.test.ServiceOperation;
+import org.switchyard.test.SwitchYardRunner;
+import org.switchyard.test.SwitchYardTestCaseConfig;
+import org.switchyard.component.test.mixins.cdi.CDIMixIn;
+
+/*
+ * Assorted methods for testing a CDI bean consuming a service in SwitchYard.
+ */
+@RunWith(SwitchYardRunner.class)
+@SwitchYardTestCaseConfig(config = "BeanPropertyTests.xml", mixins = CDIMixIn.class)
+public class BeanPropertyTest {
+
+ @ServiceOperation("PropertyService.getProperties")
+ private Invoker _invoker;
+
+ @Test
+ public void testBeanProperty() {
+ Map response = _invoker.sendInOut(null).getContent(Map.class);
+ Assert.assertEquals("bar", response.get("foo"));
+ Assert.assertEquals("composite.bar", response.get("composite.foo"));
+ Assert.assertEquals("component.bar", response.get("component.foo"));
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/BeanProviderTest.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/BeanProviderTest.java
new file mode 100644
index 000000000..6110b9688
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/BeanProviderTest.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.switchyard.Message;
+import org.switchyard.test.Invoker;
+import org.switchyard.test.ServiceOperation;
+import org.switchyard.test.SwitchYardRunner;
+import org.switchyard.test.SwitchYardTestCaseConfig;
+import org.switchyard.component.test.mixins.cdi.CDIMixIn;
+
+/*
+ * Assorted methods for testing a CDI bean providing a service in SwitchYard.
+ */
+@RunWith(SwitchYardRunner.class)
+@SwitchYardTestCaseConfig(mixins = CDIMixIn.class)
+public class BeanProviderTest {
+
+ @ServiceOperation("OneWay.oneWay")
+ private Invoker oneWay;
+ @ServiceOperation("RequestResponse.reply")
+ private Invoker reply;
+
+ @Test
+ public void invokeOneWayProviderWithInOnly() {
+ oneWay.sendInOnly("hello");
+ }
+
+ @Test
+ public void invokeRequestResponseProviderWithInOut() {
+ String ECHO_MSG = "hello";
+ Message response = reply.sendInOut(ECHO_MSG);
+
+ Assert.assertEquals(ECHO_MSG, response.getContent());
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/BeanUTConstants.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/BeanUTConstants.java
new file mode 100644
index 000000000..6cd0275bb
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/BeanUTConstants.java
@@ -0,0 +1,13 @@
+package org.switchyard.component.bean.tests;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.switchyard.component.bean.deploy.CDIBeanServiceDescriptorTest;
+
+public final class BeanUTConstants {
+ public static final List BEAN_SCANNER_BLACK_LIST =
+ Collections.unmodifiableList(
+ Arrays.asList(new Package[] {CDIBeanServiceDescriptorTest.class.getPackage()}));
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/ConsumerBean.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/ConsumerBean.java
new file mode 100644
index 000000000..df0917a26
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/ConsumerBean.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import javax.inject.Inject;
+
+import org.custommonkey.xmlunit.XMLUnit;
+import org.junit.Assert;
+import org.switchyard.common.xml.XMLHelper;
+import org.switchyard.component.bean.Reference;
+import org.switchyard.component.bean.Service;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+import java.io.StringReader;
+
+@Service(ConsumerService.class)
+public class ConsumerBean implements ConsumerService {
+
+ @Inject @Reference
+ private OneWay oneWay;
+
+ @Inject @Reference
+ private RequestResponse requestResponse;
+
+ @Override
+ public void consumeInOnlyNoArgsService() {
+ oneWay.oneWayNoArgs();
+ }
+
+ @Override
+ public void consumeInOnlyService(Object message) {
+ oneWay.oneWay(message);
+ }
+
+ @Override
+ public Object consumeInOutService(Object message) throws ConsumerException {
+ try {
+ Object reply = null;
+ reply = requestResponse.reply(message);
+ Assert.assertEquals(message, reply);
+
+ // SWITCHYARD-1688
+ System.out.println(oneWay.toString());
+ Assert.assertTrue(oneWay.hashCode() == oneWay.hashCode());
+ Assert.assertTrue(oneWay.equals(oneWay));
+ Assert.assertFalse(oneWay.equals(requestResponse));
+
+ return reply;
+ } catch (ConsumerException e) {
+ Assert.assertEquals(message, e);
+ // OK... this validates that the remote exception was transported through the
+ // Exchange fault mechanism and then rethrown by the client proxy. Create
+ // and throw a new exception...
+ throw new ConsumerException("remote-exception-received");
+ }
+ }
+
+ @Override
+ public Object consumeInOutServiceThrowsRuntimeException(Object message) {
+ try {
+ Object reply = null;
+ reply = requestResponse.reply(message);
+ Assert.assertEquals(message, reply);
+ return reply;
+ } catch (ConsumerException e) {
+ Assert.assertEquals(message, e);
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public String domOperation(Document message) {
+ try {
+ XMLUnit.compareXML(XMLHelper.getDocument(new InputSource(new StringReader(" "))), message);
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+
+ return " ";
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/ConsumerException.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/ConsumerException.java
new file mode 100644
index 000000000..cf18bfe6d
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/ConsumerException.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+public class ConsumerException extends Exception {
+
+ public ConsumerException(String message) {
+ super(message);
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/ConsumerService.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/ConsumerService.java
new file mode 100644
index 000000000..2150d8548
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/ConsumerService.java
@@ -0,0 +1,18 @@
+package org.switchyard.component.bean.tests;
+
+import org.w3c.dom.Document;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+public interface ConsumerService {
+ void consumeInOnlyNoArgsService();
+
+ void consumeInOnlyService(Object message);
+
+ Object consumeInOutService(Object message) throws ConsumerException;
+
+ Object consumeInOutServiceThrowsRuntimeException(Object message);
+
+ String domOperation(Document message);
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/InputTypeMismatchTest.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/InputTypeMismatchTest.java
new file mode 100644
index 000000000..0d2d919a2
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/InputTypeMismatchTest.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.switchyard.Message;
+import org.switchyard.test.Invoker;
+import org.switchyard.test.ServiceOperation;
+import org.switchyard.test.SwitchYardRunner;
+import org.switchyard.test.SwitchYardTestCaseConfig;
+import org.switchyard.component.test.mixins.cdi.CDIMixIn;
+
+@RunWith(SwitchYardRunner.class)
+@SwitchYardTestCaseConfig(mixins = CDIMixIn.class)
+public class InputTypeMismatchTest {
+
+ @ServiceOperation("ConsumerService.domOperation")
+ private Invoker domOperation;
+
+ @Test
+ public void test_invokeWithWrongInputParameterType() {
+ // A basic type conversion should happen automatically...
+ Message response = domOperation.sendInOut(" ");
+
+ Assert.assertEquals(" ", response.getContent());
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/LocalTransactionBean.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/LocalTransactionBean.java
new file mode 100644
index 000000000..4eb4b06ca
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/LocalTransactionBean.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import javax.inject.Inject;
+
+import org.switchyard.annotations.Requires;
+import org.switchyard.component.bean.Reference;
+import org.switchyard.component.bean.Service;
+import org.switchyard.policy.TransactionPolicy;
+
+@Requires(transaction = TransactionPolicy.SUSPENDS_TRANSACTION)
+@Service(value = OneWay.class, name = "LocalTransactionService")
+public class LocalTransactionBean implements OneWay {
+
+ @Inject @Reference @Requires(transaction = TransactionPolicy.SUSPENDS_TRANSACTION)
+ private OneWay oneWay;
+
+ @Override
+ public void oneWay(Object message) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void oneWayNoArgs() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/NoServiceReferenceBean.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/NoServiceReferenceBean.java
new file mode 100644
index 000000000..417143a86
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/NoServiceReferenceBean.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import org.switchyard.component.bean.Reference;
+
+// A Bean class which includes an @Reference but does not declare a service
+public class NoServiceReferenceBean {
+ @Reference
+ private OneWay oneWay;
+
+ public void process(String data) {
+ // NOP
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/OneWay.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/OneWay.java
new file mode 100644
index 000000000..b6f95be19
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/OneWay.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+public interface OneWay {
+
+ void oneWayNoArgs();
+
+ void oneWay(Object message);
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/OneWayBean.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/OneWayBean.java
new file mode 100644
index 000000000..243f94f2a
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/OneWayBean.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import org.switchyard.component.bean.Service;
+
+@Service(OneWay.class)
+public class OneWayBean implements OneWay {
+
+ public void oneWay(Object message) {
+ System.out.println("Received message in OneWayBean: " + message);
+ }
+
+ @Override
+ public void oneWayNoArgs() {
+ System.out.println("OneWayNoArgsBean successfully invoked with zero arguments");
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/PropertyService.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/PropertyService.java
new file mode 100644
index 000000000..0ad9a8f8b
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/PropertyService.java
@@ -0,0 +1,7 @@
+package org.switchyard.component.bean.tests;
+
+import java.util.Map;
+
+public interface PropertyService {
+ Map getProperties();
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/PropertyServiceBean.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/PropertyServiceBean.java
new file mode 100644
index 000000000..244248263
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/PropertyServiceBean.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.switchyard.component.bean.Property;
+import org.switchyard.component.bean.Service;
+
+@Service(PropertyService.class)
+public class PropertyServiceBean implements PropertyService {
+
+ @Property(name="foo")
+ String _foo;
+
+ @Property(name="composite.foo")
+ String _compositeFoo;
+
+ @Property(name="component.foo")
+ String _componentFoo;
+
+ @Override
+ public Map getProperties() {
+ Map response = new HashMap();
+ response.put("foo", _foo);
+ response.put("composite.foo", _compositeFoo);
+ response.put("component.foo", _componentFoo);
+ return response;
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/ReferenceAnnoationTest.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/ReferenceAnnoationTest.java
new file mode 100644
index 000000000..1cc0fa535
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/ReferenceAnnoationTest.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.switchyard.component.bean.config.model.BeanSwitchYardScanner;
+import org.switchyard.config.model.ScannerInput;
+import org.switchyard.config.model.composite.ComponentModel;
+import org.switchyard.config.model.composite.ComponentReferenceModel;
+import org.switchyard.config.model.switchyard.SwitchYardModel;
+
+public class ReferenceAnnoationTest {
+
+ private SwitchYardModel _scannedModel;
+
+ @Before
+ public void setUp() throws Exception {
+ BeanSwitchYardScanner scanner = new BeanSwitchYardScanner();
+ List urls = new ArrayList();
+ urls.add(new File("./target/test-classes").toURI().toURL());
+
+ ScannerInput input = new ScannerInput()
+ .setURLs(urls)
+ .setExcludePackages(BeanUTConstants.BEAN_SCANNER_BLACK_LIST);
+ _scannedModel = scanner.scan(input).getModel();
+ }
+
+ @Test
+ public void testAnnotationRenameService() throws IOException, ClassNotFoundException {
+ List components = _scannedModel.getComposite().getComponents();
+ boolean customReferenceNameFound = false;
+ for(ComponentModel component : components) {
+ if(component.getName().equals("ServiceWithReference")){
+ for (ComponentReferenceModel reference : component.getReferences()) {
+ if (reference.getName().equals(ServiceWithReferenceBean.RENAMED_REFERENCE)) {
+ customReferenceNameFound = true;
+ }
+ }
+ }
+ }
+ Assert.assertTrue(customReferenceNameFound);
+ }
+
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/ReferenceTest.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/ReferenceTest.java
new file mode 100644
index 000000000..5da6a79d2
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/ReferenceTest.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import javax.xml.namespace.QName;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.switchyard.ServiceDomain;
+import org.switchyard.test.SwitchYardRunner;
+import org.switchyard.test.SwitchYardTestCaseConfig;
+import org.switchyard.component.test.mixins.cdi.CDIMixIn;
+
+@RunWith(SwitchYardRunner.class)
+@SwitchYardTestCaseConfig(mixins = CDIMixIn.class)
+public class ReferenceTest {
+
+ private ServiceDomain domain;
+
+ @Test
+ public void verifyReferenceIsRegistered() {
+ Assert.assertNotNull(domain.getServiceReference(new QName("ConsumerService")));
+ }
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/RequestResponse.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/RequestResponse.java
new file mode 100644
index 000000000..414106fc6
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/RequestResponse.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+public interface RequestResponse {
+
+ Object reply(Object message) throws ConsumerException;
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/RequestResponseBean.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/RequestResponseBean.java
new file mode 100644
index 000000000..6e4c8019b
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/RequestResponseBean.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import org.switchyard.component.bean.Service;
+
+@Service(RequestResponse.class)
+public class RequestResponseBean implements RequestResponse {
+
+ public Object reply(Object message) throws ConsumerException {
+ if(message instanceof ConsumerException) {
+ throw (ConsumerException) message;
+ }
+
+ return message;
+ }
+
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/RequiredPoliciesTest.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/RequiredPoliciesTest.java
new file mode 100644
index 000000000..373b06c51
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/RequiredPoliciesTest.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.switchyard.component.bean.config.model.BeanSwitchYardScanner;
+import org.switchyard.config.model.ScannerInput;
+import org.switchyard.config.model.composite.ComponentImplementationModel;
+import org.switchyard.config.model.composite.ComponentModel;
+import org.switchyard.config.model.composite.ComponentReferenceModel;
+import org.switchyard.config.model.composite.ComponentServiceModel;
+import org.switchyard.config.model.switchyard.SwitchYardModel;
+import org.switchyard.policy.SecurityPolicy;
+import org.switchyard.policy.TransactionPolicy;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+public class RequiredPoliciesTest {
+
+ private SwitchYardModel _scannedModel;
+
+ @Before
+ public void setUp() throws Exception {
+ BeanSwitchYardScanner scanner = new BeanSwitchYardScanner();
+ List urls = new ArrayList();
+
+ // If running this test inside your IDE... you need to set the cwd to be the
+ // root of the bean module !!
+ urls.add(new File("./target/test-classes").toURI().toURL());
+
+ ScannerInput input = new ScannerInput()
+ .setURLs(urls)
+ .setExcludePackages(BeanUTConstants.BEAN_SCANNER_BLACK_LIST);
+ _scannedModel = scanner.scan(input).getModel();
+ }
+
+ @Test
+ public void verifyPolicyGenerated() throws Exception {
+ List components = _scannedModel.getComposite().getComponents();
+
+ boolean ssFound = false;
+ boolean ltsFound = false;
+ boolean stsFound = false;
+
+ for(ComponentModel component : components) {
+ if(component.getName().equals("SecureService")) {
+ ComponentImplementationModel impl = component.getImplementation();
+ Assert.assertTrue(impl.hasPolicyRequirement(SecurityPolicy.AUTHORIZATION.getQName()));
+ ComponentServiceModel svc = component.getServices().get(0);
+ Assert.assertTrue(svc.hasPolicyRequirement(SecurityPolicy.CLIENT_AUTHENTICATION.getQName()));
+ Assert.assertTrue(svc.hasPolicyRequirement(SecurityPolicy.CONFIDENTIALITY.getQName()));
+ ComponentReferenceModel ref = component.getReferences().get(0);
+ Assert.assertTrue(ref.hasPolicyRequirement(SecurityPolicy.AUTHORIZATION.getQName()));
+ Assert.assertTrue(ref.hasPolicyRequirement(SecurityPolicy.CLIENT_AUTHENTICATION.getQName()));
+ Assert.assertTrue(ref.hasPolicyRequirement(SecurityPolicy.CONFIDENTIALITY.getQName()));
+ ssFound = true;
+ continue;
+ }
+
+ if(component.getName().equals("LocalTransactionService")) {
+ ComponentServiceModel svc = component.getServices().get(0);
+ Assert.assertTrue(svc.hasPolicyRequirement(TransactionPolicy.SUSPENDS_TRANSACTION.getQName()));
+ ComponentReferenceModel ref = component.getReferences().get(0);
+ Assert.assertTrue(ref.hasPolicyRequirement(TransactionPolicy.SUSPENDS_TRANSACTION.getQName()));
+ ltsFound = true;
+ continue;
+ }
+
+ if(component.getName().equals("SharedTransactionService")) {
+ ComponentServiceModel svc = component.getServices().get(0);
+ Assert.assertTrue(svc.hasPolicyRequirement(TransactionPolicy.PROPAGATES_TRANSACTION.getQName()));
+ ComponentReferenceModel ref = component.getReferences().get(0);
+ Assert.assertTrue(ref.hasPolicyRequirement(TransactionPolicy.PROPAGATES_TRANSACTION.getQName()));
+ stsFound = true;
+ continue;
+ }
+ }
+
+ Assert.assertTrue("SecureService not discovered!", ssFound);
+ Assert.assertTrue("LocalTransactionService not discovered!", ltsFound);
+ Assert.assertTrue("SharedTransactionService not discovered!", stsFound);
+ }
+
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/SecureBean.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/SecureBean.java
new file mode 100644
index 000000000..71bafead3
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/SecureBean.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import static org.switchyard.policy.SecurityPolicy.AUTHORIZATION;
+import static org.switchyard.policy.SecurityPolicy.CLIENT_AUTHENTICATION;
+import static org.switchyard.policy.SecurityPolicy.CONFIDENTIALITY;
+
+import javax.inject.Inject;
+
+import org.switchyard.annotations.Requires;
+import org.switchyard.component.bean.Reference;
+import org.switchyard.component.bean.Service;
+
+@Requires(security = {AUTHORIZATION, CLIENT_AUTHENTICATION, CONFIDENTIALITY})
+@Service(value = OneWay.class, name = "SecureService")
+public class SecureBean implements OneWay {
+
+ @Inject @Reference @Requires(security = {AUTHORIZATION, CLIENT_AUTHENTICATION, CONFIDENTIALITY})
+ private OneWay oneWay;
+
+ @Override
+ public void oneWay(Object message) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void oneWayNoArgs() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceAnnotationCustomComponentNameBean.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceAnnotationCustomComponentNameBean.java
new file mode 100644
index 000000000..4eff74186
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceAnnotationCustomComponentNameBean.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import org.switchyard.component.bean.Service;
+
+@Service(value = ServiceAnnotationService.class, componentName = "CustomServiceAnnotationComponentName")
+public class ServiceAnnotationCustomComponentNameBean implements ServiceAnnotationService {
+
+ @Override
+ public void noOp(String ignored) {
+ }
+
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceAnnotationCustomNameBean.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceAnnotationCustomNameBean.java
new file mode 100644
index 000000000..31e1e7403
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceAnnotationCustomNameBean.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import org.switchyard.component.bean.Service;
+
+@Service(value = ServiceAnnotationService.class, name = "CustomServiceAnnotationServiceName")
+public class ServiceAnnotationCustomNameBean implements ServiceAnnotationService {
+
+ @Override
+ public void noOp(String ignored) {
+ }
+
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceAnnotationEmptyNameBean.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceAnnotationEmptyNameBean.java
new file mode 100644
index 000000000..8d248f1a7
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceAnnotationEmptyNameBean.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import org.switchyard.component.bean.Service;
+
+@Service(value = ServiceAnnotationService.class, name = "")
+public class ServiceAnnotationEmptyNameBean implements ServiceAnnotationService {
+
+ @Override
+ public void noOp(String ignored) {
+ }
+
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceAnnotationService.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceAnnotationService.java
new file mode 100644
index 000000000..9428b07ce
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceAnnotationService.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+public interface ServiceAnnotationService {
+
+ public void noOp(String ignored);
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceAnnotationTest.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceAnnotationTest.java
new file mode 100644
index 000000000..8eaf1fbd8
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceAnnotationTest.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.switchyard.component.bean.config.model.BeanSwitchYardScanner;
+import org.switchyard.config.model.ScannerInput;
+import org.switchyard.config.model.composite.ComponentModel;
+import org.switchyard.config.model.switchyard.SwitchYardModel;
+
+/**
+ * @author tom.fennelly@gmail.com
+ */
+public class ServiceAnnotationTest {
+
+ private SwitchYardModel _scannedModel;
+
+ @Before
+ public void setUp() throws Exception {
+ BeanSwitchYardScanner scanner = new BeanSwitchYardScanner();
+ List urls = new ArrayList();
+
+ // If running this test inside your IDE... you need to set the cwd to be the
+ // root of the bean module !!
+ urls.add(new File("./target/test-classes").toURI().toURL());
+
+ ScannerInput input = new ScannerInput()
+ .setURLs(urls)
+ .setExcludePackages(BeanUTConstants.BEAN_SCANNER_BLACK_LIST);
+ _scannedModel = scanner.scan(input).getModel();
+ }
+
+ @Test
+ public void test() throws IOException, ClassNotFoundException {
+ List components = _scannedModel.getComposite().getComponents();
+ boolean customServiceNameFound = false;
+ boolean emptyServiceNameFound = false;
+ boolean customComponentNameFound = false;
+ for(ComponentModel component : components) {
+ if(component.getName().equals("CustomServiceAnnotationServiceName")){
+ customServiceNameFound = true;
+ }
+ if(component.getName().equals("")){
+ emptyServiceNameFound = true;
+ }
+ if(component.getName().equals("CustomServiceAnnotationComponentName")){
+ customComponentNameFound = true;
+ }
+ }
+ Assert.assertTrue(customServiceNameFound);
+ Assert.assertFalse(emptyServiceNameFound);
+ Assert.assertTrue(customComponentNameFound);
+ }
+
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceWithReference.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceWithReference.java
new file mode 100644
index 000000000..16dab3e5d
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceWithReference.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+public interface ServiceWithReference {
+
+ public void noOp(String ignored);
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceWithReferenceBean.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceWithReferenceBean.java
new file mode 100644
index 000000000..6bf215533
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/ServiceWithReferenceBean.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import javax.inject.Inject;
+
+import org.switchyard.component.bean.Reference;
+import org.switchyard.component.bean.Service;
+
+@Service(ServiceWithReference.class)
+public class ServiceWithReferenceBean implements ServiceWithReference {
+
+ public static final String RENAMED_REFERENCE = "RenamedServiceReference";
+
+ @Inject @Reference
+ private OneWay _reference;
+
+ @Inject @Reference(RENAMED_REFERENCE)
+ private OneWay _renamedReference;
+
+ @Override
+ public void noOp(String ignored) {
+ }
+
+}
diff --git a/components/bean/src/test/java/org/switchyard/component/bean/tests/SharedTransactionBean.java b/components/bean/src/test/java/org/switchyard/component/bean/tests/SharedTransactionBean.java
new file mode 100644
index 000000000..570b6c983
--- /dev/null
+++ b/components/bean/src/test/java/org/switchyard/component/bean/tests/SharedTransactionBean.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.bean.tests;
+
+import javax.inject.Inject;
+
+import org.switchyard.annotations.Requires;
+import org.switchyard.component.bean.Reference;
+import org.switchyard.component.bean.Service;
+import org.switchyard.policy.TransactionPolicy;
+
+@Requires(transaction = TransactionPolicy.PROPAGATES_TRANSACTION)
+@Service(value = OneWay.class, name = "SharedTransactionService")
+public class SharedTransactionBean implements OneWay {
+
+ @Inject @Reference @Requires(transaction = TransactionPolicy.PROPAGATES_TRANSACTION)
+ private OneWay oneWay;
+
+ @Override
+ public void oneWay(Object message) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void oneWayNoArgs() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/components/bean/src/test/resources/META-INF/beans.xml b/components/bean/src/test/resources/META-INF/beans.xml
new file mode 100644
index 000000000..e69de29bb
diff --git a/components/bean/src/test/resources/jaxbautoregister/switchyard-config-01.xml b/components/bean/src/test/resources/jaxbautoregister/switchyard-config-01.xml
new file mode 100644
index 000000000..9b436c0a7
--- /dev/null
+++ b/components/bean/src/test/resources/jaxbautoregister/switchyard-config-01.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bean/src/test/resources/jaxbautoregister/switchyard-config-02.xml b/components/bean/src/test/resources/jaxbautoregister/switchyard-config-02.xml
new file mode 100644
index 000000000..ce4eea010
--- /dev/null
+++ b/components/bean/src/test/resources/jaxbautoregister/switchyard-config-02.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bean/src/test/resources/log4j.xml b/components/bean/src/test/resources/log4j.xml
new file mode 100644
index 000000000..cc45d1fd9
--- /dev/null
+++ b/components/bean/src/test/resources/log4j.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bean/src/test/resources/org/switchyard/component/bean/config/model/BeanModelTests-Complete.xml b/components/bean/src/test/resources/org/switchyard/component/bean/config/model/BeanModelTests-Complete.xml
new file mode 100644
index 000000000..a28b5e6af
--- /dev/null
+++ b/components/bean/src/test/resources/org/switchyard/component/bean/config/model/BeanModelTests-Complete.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bean/src/test/resources/org/switchyard/component/bean/invoker/ReferenceInvokerTest.xml b/components/bean/src/test/resources/org/switchyard/component/bean/invoker/ReferenceInvokerTest.xml
new file mode 100644
index 000000000..cdafa117d
--- /dev/null
+++ b/components/bean/src/test/resources/org/switchyard/component/bean/invoker/ReferenceInvokerTest.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bean/src/test/resources/org/switchyard/component/bean/tests/BeanPropertyTests.xml b/components/bean/src/test/resources/org/switchyard/component/bean/tests/BeanPropertyTests.xml
new file mode 100644
index 000000000..c26187d72
--- /dev/null
+++ b/components/bean/src/test/resources/org/switchyard/component/bean/tests/BeanPropertyTests.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpel/pom.xml b/components/bpel/pom.xml
new file mode 100644
index 000000000..420d20c68
--- /dev/null
+++ b/components/bpel/pom.xml
@@ -0,0 +1,132 @@
+
+
+
+ 4.0.0
+
+ org.switchyard.components
+ switchyard-components-parent
+ 2.1.0-SNAPSHOT
+ ../pom.xml
+
+ switchyard-component-bpel
+ jar
+ SwitchYard: BPEL Component
+ http://switchyard.org
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+
+
+ false
+
+ ${*}
+
+
+
+
+
+
+
+ org.switchyard
+ switchyard-api
+
+
+ org.switchyard
+ switchyard-common
+
+
+ org.switchyard
+ switchyard-config
+
+
+ org.switchyard
+ switchyard-deploy
+
+
+ org.switchyard
+ switchyard-transform
+
+
+ org.switchyard.components
+ switchyard-component-test-mixin-cdi
+ test
+
+
+ org.switchyard.components
+ switchyard-component-common
+
+
+ org.switchyard.components
+ switchyard-component-test-mixin-http
+ test
+
+
+ org.switchyard.components
+ switchyard-component-soap
+ test
+
+
+ org.riftsaw
+ engine
+
+
+ org.jboss.soa.bpel
+ riftsaw-bpel-api
+
+
+ org.hibernate.common
+ hibernate-commons-annotations
+
+
+ org.hibernate
+ hibernate-core
+
+
+ org.hibernate
+ hibernate-entitymanager
+
+
+ org.jboss.soa.bpel
+ riftsaw-bpel-compiler
+
+
+ org.codehaus.woodstox
+ wstx-asl
+
+
+
+
+ org.jboss.soa.bpel
+ riftsaw-dao-jpa
+
+
+ org.jboss
+ jboss-vfs
+ provided
+
+
+ org.jboss.as
+ jboss-as-naming
+ provided
+
+
+ org.jboss.as
+ jboss-as-server
+ provided
+
+
+
diff --git a/components/bpel/src/main/java/org/switchyard/component/bpel/BPELFault.java b/components/bpel/src/main/java/org/switchyard/component/bpel/BPELFault.java
new file mode 100644
index 000000000..c3e570643
--- /dev/null
+++ b/components/bpel/src/main/java/org/switchyard/component/bpel/BPELFault.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpel;
+
+import org.switchyard.HandlerException;
+import org.switchyard.annotations.DefaultType;
+
+/**
+ * This class represents a thin wrapper around a SOAP Fault
+ * generated when a BPEL process returns a fault response.
+ *
+ */
+@Deprecated
+@DefaultType(BPELFault.MESSAGE_TYPE)
+public class BPELFault extends HandlerException {
+
+ /**
+ * The message type for the BPEL fault.
+ */
+ public static final String MESSAGE_TYPE =
+ "java:org.switchyard.component.bpel.BPELFault";
+
+ /**
+ * Serialization id.
+ */
+ private static final long serialVersionUID = 1L;
+
+ private javax.xml.soap.SOAPFault _fault=null;
+
+ /**
+ * This is the constructor for the BPEL fault.
+ *
+ * @param fault The SOAP fault being wrapped
+ */
+ public BPELFault(javax.xml.soap.SOAPFault fault) {
+ super("BPEL Fault ["+ fault.getFaultCode()+ "]");
+ _fault = fault;
+ }
+
+ /**
+ * This method returns the SOAP fault.
+ *
+ * @return The SOAP fault
+ */
+ public javax.xml.soap.SOAPFault getSOAPFault() {
+ return (_fault);
+ }
+}
diff --git a/components/bpel/src/main/java/org/switchyard/component/bpel/BPELLogger.java b/components/bpel/src/main/java/org/switchyard/component/bpel/BPELLogger.java
new file mode 100644
index 000000000..55ae49bc1
--- /dev/null
+++ b/components/bpel/src/main/java/org/switchyard/component/bpel/BPELLogger.java
@@ -0,0 +1,120 @@
+package org.switchyard.component.bpel;
+
+import javax.xml.namespace.QName;
+import org.jboss.logging.Cause;
+import org.jboss.logging.Logger;
+import org.jboss.logging.Logger.Level;
+import org.jboss.logging.annotations.LogMessage;
+import org.jboss.logging.annotations.Message;
+import org.jboss.logging.annotations.MessageLogger;
+/**
+ *
+ * This file is using the subset 30800-31199 for logger messages.
+ *
+ *
+ */
+@MessageLogger(projectCode = "SWITCHYARD")
+public interface BPELLogger {
+ /**
+ * A root logger with the category of the package name.
+ */
+ BPELLogger ROOT_LOGGER = Logger.getMessageLogger(BPELLogger.class, BPELLogger.class.getPackage().getName());
+
+ /**
+ * initBPELComponent method definition.
+ */
+ @LogMessage(level = Level.INFO)
+ @Message(id = 30800, value = "Init BPEL component")
+ void initBPELComponent();
+
+ /**
+ * destroyBPELComponent method definition.
+ */
+ @LogMessage(level = Level.INFO)
+ @Message(id = 30801, value = "Destroy BPEL component")
+ void destroyBPELComponent();
+
+ /**
+ * failedToCloseBPELEngine method definition.
+ * @param e the e
+ */
+ @LogMessage(level = Level.ERROR)
+ @Message(id = 30802, value = "Failed to close BPEL engine")
+ void failedToCloseBPELEngine(@Cause Exception e);
+
+ /**
+ * failedToObtainDeploymentNameFromURL method definition.
+ * @param urlpath the urlpath
+ */
+ @LogMessage(level = Level.ERROR)
+ @Message(id = 30803, value = "Failed to obtain deployment name from URL: %s")
+ void failedToObtainDeploymentNameFromURL(String urlpath);
+
+ /**
+ * unableToLocateDeploymentDescriptorDeployXmlToDeriveDeploymentName method definition.
+ */
+ @LogMessage(level = Level.ERROR)
+ @Message(id = 30804, value = "Unable to locate deployment descriptor (deploy.xml) to derive deployment name")
+ void unableToLocateDeploymentDescriptorDeployXmlToDeriveDeploymentName();
+
+ /**
+ * deploymentNameIs method definition.
+ * @param ret the ret
+ */
+ @LogMessage(level = Level.INFO)
+ @Message(id = 30805, value = "Deployment name is: %s")
+ void deploymentNameIs(String ret);
+
+ /**
+ * unableToResolveTheDeploymentURL method definition.
+ * @param t the t
+ */
+ @LogMessage(level = Level.ERROR)
+ @Message(id = 30806, value = "Unable to resolve the deployment URL")
+ void unableToResolveTheDeploymentURL(@Cause java.lang.NoClassDefFoundError t);
+
+ /**
+ * unableToTransformPropertyValueIntoUndeployDelayValue method definition.
+ * @param e the e
+ * @param delayValue delayValue
+ */
+ @LogMessage(level = Level.ERROR)
+ @Message(id = 30807, value = "Unable to transform property value '%s' into undeploy delay value")
+ void unableToTransformPropertyValueIntoUndeployDelayValue(@Cause Exception e, String delayValue);
+
+ /**
+ * failedToUndeploy method definition.
+ * @param serviceName the serviceName
+ * @param e the e
+ */
+ @LogMessage(level = Level.ERROR)
+ @Message(id = 30808, value = "Failed to undeploy '%s'")
+ void failedToUndeploy(QName serviceName, @Cause Exception e);
+
+ /**
+ * noServiceReferencesFoundForProcess method definition.
+ * @param localProcessName the localProcessName
+ */
+ @LogMessage(level = Level.ERROR)
+ @Message(id = 30809, value = "No service references found for process '%s'")
+ void noServiceReferencesFoundForProcess(String localProcessName);
+
+ /**
+ * noServiceFoundFor method definition.
+ * @param serviceName the serviceName
+ * @param portName the portName
+ */
+ @LogMessage(level = Level.ERROR)
+ @Message(id = 30810, value = "No service found for '%s' (port %s)")
+ void noServiceFoundFor(String serviceName, String portName);
+
+ /**
+ * noServiceFoundFor method definition.
+ * @param serviceName the serviceName
+ */
+ @LogMessage(level = Level.ERROR)
+ @Message(id = 30811, value = "No service found for '%s")
+ void noServiceFoundFor(String serviceName);
+
+}
+
diff --git a/components/bpel/src/main/java/org/switchyard/component/bpel/BPELMessages.java b/components/bpel/src/main/java/org/switchyard/component/bpel/BPELMessages.java
new file mode 100644
index 000000000..210896d90
--- /dev/null
+++ b/components/bpel/src/main/java/org/switchyard/component/bpel/BPELMessages.java
@@ -0,0 +1,119 @@
+package org.switchyard.component.bpel;
+
+import org.jboss.logging.Cause;
+import org.jboss.logging.Messages;
+import org.jboss.logging.annotations.Message;
+import org.jboss.logging.annotations.MessageBundle;
+import org.switchyard.HandlerException;
+import org.switchyard.SwitchYardException;
+/**
+ *
+ * This file is using the subset 31200-31599 for logger messages.
+ *
+ *
+ */
+@MessageBundle(projectCode = "SWITCHYARD")
+public interface BPELMessages {
+ /**
+ * The default messages.
+ */
+ BPELMessages MESSAGES = Messages.getBundle(BPELMessages.class);
+
+ /**
+ * interfaceNotDefinedForComponentWithBPELImplementation method definition.
+ * @return SwitchYardException
+ */
+ @Message(id = 31200, value = "Interface not defined for component with BPEL implementation")
+ SwitchYardException interfaceNotDefinedForComponentWithBPELImplementation();
+
+ /**
+ * failedToLoadDefaultProperties method definition.
+ * @param e the e
+ * @return SwitchYardException
+ */
+ @Message(id = 31201, value = "Failed to load default properties")
+ SwitchYardException failedToLoadDefaultProperties(@Cause Exception e);
+
+ /**
+ * failedToInitializeTheEngine method definition.
+ * @param e the e
+ * @return SwitchYardException
+ */
+ @Message(id = 31202, value = "Failed to initialize the engine")
+ SwitchYardException failedToInitializeTheEngine(@Cause Exception e);
+
+ /**
+ * unknownDeploymentEnvironment method definition.
+ * @return SwitchYardException
+ */
+ @Message(id = 31203, value = "Unknown deployment environment")
+ SwitchYardException unknownDeploymentEnvironment();
+
+ /**
+ * couldNotFindBPELImplementationAssociatedWithReference method definition.
+ * @return SwitchYardException
+ */
+ @Message(id = 31207, value = "Could not find BPEL implementation associated with reference")
+ SwitchYardException couldNotFindBPELImplementationAssociatedWithReference();
+
+ /**
+ * timedOutAfterMsWaitingOnSynchronousResponseFromTargetService method definition.
+ * @param waitTimeout the waitTimeout
+ * @param serviceReferenceName serviceReferenceName
+ * @return HandlerException
+ */
+ @Message(id = 31208, value = "Timed out after %s ms waiting on synchronous response from target service '%s'.")
+ HandlerException timedOutAfterMsWaitingOnSynchronousResponseFromTargetService(long waitTimeout, String serviceReferenceName);
+
+ /**
+ * responseNotReturnedFromOperationOnService method definition.
+ * @param operationName the operationName
+ * @param serviceReferenceName serviceReferenceName
+ * @return Exception
+ */
+ @Message(id = 31209, value = "Response not returned from operation '%s' on service: %s")
+ Exception responseNotReturnedFromOperationOnService(String operationName, String serviceReferenceName);
+
+ /**
+ * wSDLLocationHasNotBeenSpecified method definition.
+ * @return SwitchYardException
+ */
+ @Message(id = 31211, value = "WSDL location has not been specified")
+ SwitchYardException wSDLLocationHasNotBeenSpecified();
+
+ /**
+ * failedToLoadWSDL method definition.
+ * @param location the location
+ * @param e the e
+ * @return SwitchYardException
+ */
+ @Message(id = 31212, value = "Failed to load WSDL '%s'")
+ SwitchYardException failedToLoadWSDL(String location, @Cause Exception e);
+
+ /**
+ * unableToFindFaultOn method definition.
+ * @param faultName the faultName
+ * @param operationName operationName
+ * @return SwitchYardException
+ */
+ @Message(id = 31214, value = "Unable to find fault '%s' on operation '%s'")
+ SwitchYardException unableToFindFaultOn(String faultName, String operationName);
+
+ /**
+ * onlyExpectingASingleMessagePartForOperation method definition.
+ * @param operationName operationName
+ * @return SwitchYardException
+ */
+ @Message(id = 31215, value = "Only expecting a single message part for operation '%s'")
+ SwitchYardException onlyExpectingASingleMessagePartForOperation(String operationName);
+
+ /**
+ * unableToFindPartNameFor method definition.
+ * @param operationName operationName
+ * @return SwitchYardException
+ */
+ @Message(id = 31216, value = "Unable to find part name for operation '%s'")
+ SwitchYardException unableToFindPartNameFor(String operationName);
+
+}
+
diff --git a/components/bpel/src/main/java/org/switchyard/component/bpel/DefaultBPELFaultTransformer.java b/components/bpel/src/main/java/org/switchyard/component/bpel/DefaultBPELFaultTransformer.java
new file mode 100644
index 000000000..f6e8830a8
--- /dev/null
+++ b/components/bpel/src/main/java/org/switchyard/component/bpel/DefaultBPELFaultTransformer.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpel;
+
+import javax.xml.namespace.QName;
+
+import org.switchyard.config.model.Scannable;
+import org.switchyard.transform.BaseTransformer;
+import org.w3c.dom.Node;
+
+/**
+ * This class provides the default transformation for a BPELFault into a DOM Node.
+ *
+ * @param The BPEL fault
+ * @param The DOM Node
+ */
+@Deprecated
+@Scannable(false)
+public class DefaultBPELFaultTransformer extends BaseTransformer {
+
+ @Override
+ public QName getFrom() {
+ return toMessageType(BPELFault.class);
+ }
+
+ @Override
+ public QName getTo() {
+ return toMessageType(Node.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public org.w3c.dom.Node transform(BPELFault from) {
+ return (from.getSOAPFault());
+ }
+}
diff --git a/components/bpel/src/main/java/org/switchyard/component/bpel/deploy/BPELActivator.java b/components/bpel/src/main/java/org/switchyard/component/bpel/deploy/BPELActivator.java
new file mode 100644
index 000000000..149d717bf
--- /dev/null
+++ b/components/bpel/src/main/java/org/switchyard/component/bpel/deploy/BPELActivator.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpel.deploy;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.riftsaw.engine.BPELEngine;
+import org.switchyard.config.model.implementation.bpel.BPELComponentImplementationModel;
+import org.switchyard.component.bpel.BPELMessages;
+import org.switchyard.component.bpel.exchange.BPELExchangeHandler;
+import org.switchyard.component.bpel.exchange.BPELExchangeHandlerFactory;
+import org.switchyard.component.bpel.riftsaw.RiftsawServiceLocator;
+import org.switchyard.config.model.composite.ComponentModel;
+import org.switchyard.config.model.composite.ComponentReferenceModel;
+import org.switchyard.config.model.composite.ComponentServiceModel;
+import org.switchyard.deploy.BaseActivator;
+import org.switchyard.deploy.ServiceHandler;
+
+/**
+ * Activator for the BPEL component.
+ *
+ */
+public class BPELActivator extends BaseActivator {
+
+ /**
+ * BPEL component activator type name.
+ */
+ public static final String BPEL_TYPE = "bpel";
+
+ private static final Logger LOG = Logger.getLogger(BPELActivator.class);
+
+ private static Map _handlers = new HashMap();
+
+ private BPELEngine _engine = null;
+ private RiftsawServiceLocator _locator = null;
+ private java.util.Properties _config = null;
+
+
+ /**
+ * Constructs a new Activator of type "bpel".
+ *
+ * @param engine The BPEL engine
+ * @param locator The service locator
+ * @param config The properties
+ */
+ public BPELActivator(BPELEngine engine, RiftsawServiceLocator locator, java.util.Properties config) {
+ super(BPEL_TYPE);
+
+ _engine = engine;
+ _locator = locator;
+ _config = config;
+ }
+
+ @Override
+ public ServiceHandler activateService(QName serviceName, ComponentModel config) {
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Activate service: "+serviceName+" config="+config);
+ }
+
+ BPELExchangeHandler handler = BPELExchangeHandlerFactory.instance().newBPELExchangeHandler(getServiceDomain());
+ BPELComponentImplementationModel bciModel = (BPELComponentImplementationModel)config.getImplementation();
+ ComponentServiceModel service = null;
+ for (ComponentServiceModel csm : config.getServices()) {
+ if (csm.getQName().equals(serviceName)) {
+ service = csm;
+ break;
+ }
+ }
+
+ if ((service == null) || (service.getInterface() == null)) {
+ throw BPELMessages.MESSAGES.interfaceNotDefinedForComponentWithBPELImplementation();
+ }
+
+ // take care of references
+ for (ComponentReferenceModel crm : config.getReferences()) {
+ _locator.addServiceDomain(crm.getQName(), getServiceDomain());
+ _locator.initialiseReference(crm);
+ }
+
+ handler.init(serviceName, bciModel,
+ service.getInterface().getInterface(), _engine, _config);
+
+ _handlers.put(serviceName, handler);
+
+ return handler;
+ }
+
+ @Override
+ public void deactivateService(QName name, ServiceHandler handler) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("De-activate service: " + name + " handler=" + handler);
+ }
+
+ _handlers.remove(name);
+ }
+
+}
diff --git a/components/bpel/src/main/java/org/switchyard/component/bpel/deploy/BPELComponent.java b/components/bpel/src/main/java/org/switchyard/component/bpel/deploy/BPELComponent.java
new file mode 100644
index 000000000..af1e73f2b
--- /dev/null
+++ b/components/bpel/src/main/java/org/switchyard/component/bpel/deploy/BPELComponent.java
@@ -0,0 +1,237 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpel.deploy;
+
+import java.util.Properties;
+
+import org.jboss.logging.Logger;
+import org.apache.ode.bpel.evt.BpelEvent;
+import org.riftsaw.engine.BPELEngine;
+import org.riftsaw.engine.BPELEngineListener;
+import org.riftsaw.engine.ServiceLocator;
+import org.switchyard.ServiceDomain;
+import org.switchyard.component.bpel.riftsaw.RiftsawServiceLocator;
+import org.switchyard.config.Configuration;
+import org.switchyard.component.bpel.BPELLogger;
+import org.switchyard.component.bpel.BPELMessages;
+import org.switchyard.deploy.Activator;
+import org.switchyard.deploy.BaseComponent;
+
+/**
+ * An implementation of BPEL component.
+ */
+public class BPELComponent extends BaseComponent {
+
+ private static final Logger LOG = Logger.getLogger(BPELComponent.class);
+
+ private final BPELEngineInstance _bpelEngineInstance;
+ private static java.util.Properties _config;
+ private static BPELEngine _engine;
+ private static boolean _initialized;
+
+ /**
+ * Default constructor.
+ */
+ public BPELComponent() {
+ this(new BPELEngineInstanceImpl());
+ }
+
+ protected BPELComponent(BPELEngineInstance bpelEngineInstance) {
+ super(BPELActivator.BPEL_TYPE);
+ setName("BPELComponent");
+ _bpelEngineInstance = bpelEngineInstance;
+ }
+
+ /* (non-Javadoc)
+ * @see org.switchyard.deploy.Component#init(org.switchyard.config.Configuration)
+ */
+ @Override
+ public void init(Configuration config) {
+ super.init(config);
+
+ initConfig();
+ }
+
+ /**
+ * This method initializes the configuration information for use
+ * by the BPEL engine.
+ */
+ protected void initConfig() {
+ synchronized (BPELComponent.class) {
+ if (_initialized) {
+ return;
+ }
+
+ BPELLogger.ROOT_LOGGER.initBPELComponent();
+
+ ClassLoader current=Thread.currentThread().getContextClassLoader();
+
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+
+ try {
+ // Initialize the BPEL engine configuration
+ _config = new java.util.Properties();
+
+ // Load default properties
+ try {
+ java.io.InputStream is = getClass().getClassLoader().getResourceAsStream("bpel.properties");
+
+ _config.load(is);
+ } catch (Exception e) {
+ throw BPELMessages.MESSAGES.failedToLoadDefaultProperties(e);
+ }
+
+ if (getConfig() != null) {
+ // Overwrite default properties with values from configuration
+ for (Configuration child : getConfig().getChildren()) {
+ if (LOG.isDebugEnabled()) {
+ if (_config.containsKey(child.getName())) {
+ LOG.debug("Overriding BPEL property: "+child.getName()
+ +" = "+child.getValue());
+ } else {
+ LOG.debug("Setting BPEL property: "+child.getName()
+ +" = "+child.getValue());
+ }
+ }
+ _config.put(child.getName(), child.getValue());
+ }
+ }
+ _bpelEngineInstance.init(new RiftsawServiceLocator(), _config);
+ } finally {
+ Thread.currentThread().setContextClassLoader(current);
+ }
+
+ _initialized = true;
+ }
+ }
+
+ protected BPELEngine getEngine(final ServiceDomain domain) {
+ synchronized (BPELComponent.class) {
+ if (_engine == null) {
+ initConfig();
+ try {
+ _engine = _bpelEngineInstance.getBPELEngine();
+ } catch (Exception e) {
+ throw BPELMessages.MESSAGES.failedToInitializeTheEngine(e);
+ }
+ _engine.register(new BPELEngineListener() {
+ public void onEvent(BpelEvent bpelEvent) {
+ domain.getEventPublisher().publish(bpelEvent);
+ }
+ });
+ }
+ }
+ return _engine;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void destroy() {
+ super.destroy();
+
+ BPELLogger.ROOT_LOGGER.destroyBPELComponent();
+ synchronized (BPELComponent.class) {
+ if (_engine != null) {
+ try {
+ synchronized (_engine) {
+ _bpelEngineInstance.dispose();
+ _engine = null;
+ }
+ } catch (Exception e) {
+ BPELLogger.ROOT_LOGGER.failedToCloseBPELEngine(e);
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.switchyard.deploy.Component#createActivator(org.switchyard.ServiceDomain)
+ */
+ @Override
+ public Activator createActivator(ServiceDomain domain) {
+ if (domain == null) {
+ throw new NullPointerException("domain cannot be null");
+ }
+
+ BPELEngine engine = getEngine(domain);
+ BPELActivator activator = new BPELActivator(engine, (RiftsawServiceLocator) engine.getServiceLocator(), _config);
+ activator.setServiceDomain(domain);
+
+ return activator;
+ }
+
+ /**
+ * Simple interface for managing the BPELEngine.
+ */
+ protected static interface BPELEngineInstance {
+
+ /**
+ * Initialize the factory.
+ *
+ * @param serviceLocator the service locator.
+ * @param config the configuration.
+ */
+ public void init(ServiceLocator serviceLocator, java.util.Properties config);
+
+ /**
+ * Returns the BPELEngine instance.
+ *
+ * @return the BPELEngine.
+ * @throws Exception if something goes awry.
+ */
+ public BPELEngine getBPELEngine() throws Exception;
+
+ /**
+ * Dispose any resources allocated by the factory.
+ *
+ * @throws Exception if something goes awry.
+ */
+ public void dispose() throws Exception;
+ }
+
+ private static final class BPELEngineInstanceImpl implements BPELEngineInstance {
+
+ private BPELEngine _engine;
+
+ @Override
+ public synchronized void init(ServiceLocator serviceLocator, Properties config) {
+ org.riftsaw.engine.BPELEngineFactory.setConfig(config);
+ org.riftsaw.engine.BPELEngineFactory.setServiceLocator(serviceLocator);
+ }
+
+ @Override
+ public synchronized BPELEngine getBPELEngine() throws Exception {
+ if (_engine == null) {
+ final ClassLoader origTCCL = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+ _engine = org.riftsaw.engine.BPELEngineFactory.getEngine();
+ } finally {
+ Thread.currentThread().setContextClassLoader(origTCCL);
+ }
+ }
+ return _engine;
+ }
+
+ @Override
+ public synchronized void dispose() throws Exception {
+ if (_engine != null) {
+ _engine.close();
+ _engine = null;
+ }
+ }
+ }
+}
diff --git a/components/bpel/src/main/java/org/switchyard/component/bpel/exchange/BPELExchangeHandler.java b/components/bpel/src/main/java/org/switchyard/component/bpel/exchange/BPELExchangeHandler.java
new file mode 100644
index 000000000..3b529a898
--- /dev/null
+++ b/components/bpel/src/main/java/org/switchyard/component/bpel/exchange/BPELExchangeHandler.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpel.exchange;
+
+import javax.xml.namespace.QName;
+
+import org.riftsaw.engine.BPELEngine;
+import org.switchyard.config.model.implementation.bpel.BPELComponentImplementationModel;
+import org.switchyard.deploy.ServiceHandler;
+
+/**
+ * The ExchangeHandler for the BPEL component.
+ *
+ */
+public interface BPELExchangeHandler extends ServiceHandler {
+
+ /**
+ * Initializes the BPELExchangeHandler.
+ *
+ * @param qname the qualified name
+ * @param model the configuration
+ * @param intf the WSDL interface details
+ * @param engine the BPEL engine
+ * @param config The configuration
+ */
+ public void init(QName qname, BPELComponentImplementationModel model,
+ String intf, BPELEngine engine, java.util.Properties config);
+
+}
diff --git a/components/bpel/src/main/java/org/switchyard/component/bpel/exchange/BPELExchangeHandlerFactory.java b/components/bpel/src/main/java/org/switchyard/component/bpel/exchange/BPELExchangeHandlerFactory.java
new file mode 100644
index 000000000..07562674d
--- /dev/null
+++ b/components/bpel/src/main/java/org/switchyard/component/bpel/exchange/BPELExchangeHandlerFactory.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpel.exchange;
+
+import java.util.List;
+
+import org.switchyard.ServiceDomain;
+import org.switchyard.common.util.ProviderRegistry;
+
+/**
+ * Creates BPELExchangeHandlers via the JDK ServiceLoader mechanism.
+ *
+ */
+public abstract class BPELExchangeHandlerFactory {
+
+ private static final BPELExchangeHandlerFactory INSTANCE;
+ static {
+ List services = ProviderRegistry.getProviders(BPELExchangeHandlerFactory.class);
+ INSTANCE = services.iterator().next();
+ }
+
+ /**
+ * Creates a new BPELExchangeHandler in the specified ServiceDomain.
+ *
+ * @param serviceDomain the specified ServiceDomain
+ * @return the BPELExchangeHandler
+ */
+ public abstract BPELExchangeHandler newBPELExchangeHandler(ServiceDomain serviceDomain);
+
+ /**
+ * Returns the singleton instance of the BPELExchangeHandlerFactory.
+ *
+ * @return the singleton instance
+ */
+ public static BPELExchangeHandlerFactory instance() {
+ return INSTANCE;
+ }
+
+}
diff --git a/components/bpel/src/main/java/org/switchyard/component/bpel/riftsaw/RiftsawBPELExchangeHandler.java b/components/bpel/src/main/java/org/switchyard/component/bpel/riftsaw/RiftsawBPELExchangeHandler.java
new file mode 100644
index 000000000..e40f923b6
--- /dev/null
+++ b/components/bpel/src/main/java/org/switchyard/component/bpel/riftsaw/RiftsawBPELExchangeHandler.java
@@ -0,0 +1,385 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpel.riftsaw;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.Detail;
+import javax.xml.soap.SOAPFault;
+
+import org.jboss.logging.Logger;
+import org.riftsaw.engine.BPELEngine;
+import org.riftsaw.engine.DeploymentRef;
+import org.riftsaw.engine.Fault;
+import org.switchyard.Exchange;
+import org.switchyard.ExchangePattern;
+import org.switchyard.HandlerException;
+import org.switchyard.Message;
+import org.switchyard.Property;
+import org.switchyard.ServiceDomain;
+import org.switchyard.component.bpel.BPELMessages;
+import org.switchyard.component.bpel.exchange.BPELExchangeHandler;
+import org.switchyard.component.common.label.EndpointLabel;
+import org.switchyard.component.bpel.BPELLogger;
+import org.switchyard.config.model.implementation.bpel.BPELComponentImplementationModel;
+import org.switchyard.deploy.BaseServiceHandler;
+import org.switchyard.SwitchYardException;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * A Riftsaw implementation of a BPEL ExchangeHandler.
+ *
+ */
+public class RiftsawBPELExchangeHandler extends BaseServiceHandler implements BPELExchangeHandler {
+
+ private static final int UNDEPLOY_DELAY = 10000;
+
+ private static final String VFS_SCHEME = "vfs";
+
+ private static final String DEPLOY_XML = "deploy.xml";
+
+ private static final Logger LOG =
+ Logger.getLogger(RiftsawBPELExchangeHandler.class);
+
+ private BPELEngine _engine = null;
+ private QName _serviceName = null;
+ private QName _processName = null;
+ private javax.wsdl.Definition _wsdl = null;
+ private javax.wsdl.PortType _portType = null;
+ private long _undeployDelay=UNDEPLOY_DELAY;
+ private BPELComponentImplementationModel _model;
+ private Properties _config;
+
+ private static Map _serviceRefToCompositeMap=
+ new HashMap();
+ private static Map _deployed=
+ new HashMap();
+ private static Timer _timer=new Timer();
+ private static List _undeployed=new ArrayList();
+
+ /**
+ * Constructs a new RiftSaw BPEL ExchangeHandler within the specified ServiceDomain.
+ * @param domain the service domain.
+ */
+ public RiftsawBPELExchangeHandler(final ServiceDomain domain) {
+ super(domain);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void init(QName qname, BPELComponentImplementationModel model,
+ String intf, BPELEngine engine, Properties config) {
+
+ _engine = engine;
+
+ _wsdl = WSDLHelper.getWSDLDefinition(intf);
+
+ _portType = WSDLHelper.getPortType(intf, _wsdl);
+
+ _serviceName = qname;
+
+ _processName = model.getProcessQName();
+
+ _model = model;
+
+ _config = config;
+ }
+
+ /**
+ * This method returns the deployment name associated with the
+ * deployed app.
+ *
+ * @return The deployment name
+ * @throws Exception Failed to obtain the deployment name
+ */
+ protected String getDeploymentName() throws Exception {
+ String ret=null;
+
+ java.net.URL url = Thread.currentThread().
+ getContextClassLoader().getResource(DEPLOY_XML);
+
+ if (url != null) {
+ String urlpath=url.toString();
+
+ // Remove deploy.xml from end of path, removing an
+ // extra character for the path separator
+ urlpath = urlpath.substring(0, urlpath.length()-DEPLOY_XML.length()-1);
+
+ int fileSeparatorIndex = urlpath.lastIndexOf('/');
+
+ if (fileSeparatorIndex != -1) {
+ ret = urlpath.substring(fileSeparatorIndex+1);
+
+ int suffixIndex = ret.lastIndexOf('.');
+
+ if (suffixIndex != -1) {
+ ret = ret.substring(0, suffixIndex);
+ }
+ } else {
+ BPELLogger.ROOT_LOGGER.failedToObtainDeploymentNameFromURL(urlpath);
+ }
+ } else {
+ BPELLogger.ROOT_LOGGER.unableToLocateDeploymentDescriptorDeployXmlToDeriveDeploymentName();
+ }
+
+ if (LOG.isDebugEnabled()) {
+ BPELLogger.ROOT_LOGGER.deploymentNameIs(ret);
+ }
+
+ return (ret);
+ }
+
+ /**
+ * This method returns the file associated with the BPEL deployment
+ * archive or root folder.
+ *
+ * @return The deployment
+ * @throws Exception Failed to obtain deployment folder/archive
+ */
+ protected java.io.File getDeployment() throws Exception {
+ java.io.File ret = null;
+
+ java.net.URL url = Thread.currentThread().
+ getContextClassLoader().getResource(DEPLOY_XML);
+ int index = url.toString().indexOf(".jar");
+
+ // Check if url contains a jar
+ if (index != -1) {
+
+ if (url.getProtocol().equals(VFS_SCHEME)) {
+ // AS7 deployment
+ try {
+ org.jboss.vfs.VirtualFile vfile=org.jboss.vfs.VFS.getChild(url.toURI());
+
+ // Recursively get all files
+ List children=vfile.getParent().getChildrenRecursively();
+ for (org.jboss.vfs.VirtualFile child : children) {
+ // Need to request the physical file to have it expanded
+ // on the file system
+ child.getPhysicalFile();
+ }
+
+ // Virtual file is for the deployment descriptor, so we need
+ // the parent file which represents the root of the deployment
+ ret = vfile.getPhysicalFile().getParentFile();
+
+ } catch (java.lang.NoClassDefFoundError t) {
+ BPELLogger.ROOT_LOGGER.unableToResolveTheDeploymentURL(t);
+ }
+
+ } else {
+ throw BPELMessages.MESSAGES.unknownDeploymentEnvironment();
+ }
+ } else {
+ // Retrieve parent folder of deployment descriptor
+ ret = new java.io.File(url.toURI()).getParentFile();
+ }
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Deployment=" + ret);
+ }
+
+ return (ret);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void doStart() {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("START: " + _serviceName);
+ }
+ // Setup configuration
+ if (_config.containsKey("bpel.undeploy.delay")) {
+ try {
+ _undeployDelay = Long.parseLong(_config.getProperty("bpel.undeploy.delay"));
+
+ } catch (Exception e) {
+ BPELLogger.ROOT_LOGGER.unableToTransformPropertyValueIntoUndeployDelayValue(e, _config.getProperty("bpel.undeploy.delay"));
+ }
+ }
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Undeployment delay="+_undeployDelay+"ms");
+ }
+
+ // Check if composite is already been initialized for BPEL processes
+ QName compositeName = _model.getComponent().getComposite().getQName();
+
+ if (!_serviceRefToCompositeMap.containsValue(compositeName)) {
+ try {
+ java.io.File deployFile=getDeployment();
+
+ DeploymentRef ref=_engine.deploy(getDeploymentName(), deployFile);
+
+ _deployed.put(_serviceName, ref);
+
+ // Remove, in case marked for undeployment as part
+ // of replacing an existing deployed jar
+ _undeployed.remove(_serviceName);
+ } catch (Exception e) {
+ throw new SwitchYardException(e);
+ }
+ }
+
+ SwitchYardPropertyFunction.setPropertyResolver(_processName, _model.getModelConfiguration().getPropertyResolver());
+ _serviceRefToCompositeMap.put(_serviceName, compositeName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void handleMessage(final Exchange exchange) throws HandlerException {
+ Message message = exchange.getMessage();
+ Node request = message.getContent(Node.class);
+
+ Map headers = new HashMap();
+ for (Property p : exchange.getContext().getProperties()) {
+ if (p.hasLabel(EndpointLabel.SOAP.label())) {
+ headers.put(p.getName(), p.getValue());
+ }
+ }
+
+ try {
+ // Find part name associated with operation on port type
+ javax.wsdl.Operation operation =
+ _portType.getOperation(exchange.getContract().
+ getProviderOperation().getName(),
+ null, null);
+
+ Element newreq =
+ WSDLHelper.wrapRequestMessagePart((Element) request,
+ operation);
+
+ // Invoke the operation on the BPEL process
+ Element response = _engine.invoke(_serviceName, null,
+ exchange.getContract().
+ getProviderOperation().getName(),
+ newreq, headers);
+
+ if (exchange.getContract().getProviderOperation().
+ getExchangePattern().equals(ExchangePattern.IN_OUT)) {
+
+ Message reply = exchange.createMessage();
+
+ // Strip off wrapper and part to just return
+ // the part contents
+ reply.setContent(WSDLHelper.unwrapMessagePart(response));
+
+ // Set header parts for a response message
+ for (Map.Entry e : headers.entrySet()) {
+ exchange.getContext(reply).setProperty(e.getKey(),
+ headers.get(e.getKey())).addLabels(EndpointLabel.SOAP.label());
+ }
+
+ exchange.send(reply);
+ }
+ } catch (Fault f) {
+ SOAPFault fault = null;
+
+ try {
+ fault = javax.xml.soap.SOAPFactory.newInstance().
+ createFault("", f.getFaultName());
+
+ Detail detail=fault.addDetail();
+ Node cloned=detail.getOwnerDocument().importNode(WSDLHelper.unwrapMessagePart(f.getFaultMessage()), true);
+ detail.appendChild(cloned);
+
+ } catch (Exception e) {
+ throw new HandlerException(e);
+ }
+
+ Message msg = exchange.createMessage().setContent(fault);
+ exchange.sendFault(msg);
+
+ } catch (Exception e) {
+ throw new HandlerException(e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doStop() {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("STOP: " + _serviceName);
+ }
+
+ _undeployed.add(_serviceName);
+
+ if (_undeployDelay > 0) {
+ _timer.schedule(new TimerTask() {
+ public void run() {
+ undeploy();
+ }
+
+ }, _undeployDelay);
+ } else {
+ undeploy();
+ }
+
+ _serviceRefToCompositeMap.remove(_serviceName);
+ }
+
+ private void undeploy() {
+ synchronized (_undeployed) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Checking whether to undeploy '"
+ +_serviceName+"'");
+ }
+
+ if (_undeployed.contains(_serviceName)
+ && _deployed.containsKey(_serviceName)) {
+ DeploymentRef ref=_deployed.get(_serviceName);
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Undeploy '"
+ +_serviceName+"' with ref: "+ref);
+ }
+
+ if (ref != null) {
+ try {
+ _engine.undeploy(ref);
+ } catch (Exception e) {
+ BPELLogger.ROOT_LOGGER.failedToUndeploy(_serviceName, e);
+ }
+ }
+
+ _deployed.remove(_serviceName);
+ _undeployed.remove(_serviceName);
+ }
+ SwitchYardPropertyFunction.removePropertyResolver(_processName);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void destroy() {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("DESTROY: " + _serviceName);
+ }
+ }
+
+}
diff --git a/components/bpel/src/main/java/org/switchyard/component/bpel/riftsaw/RiftsawBPELExchangeHandlerFactory.java b/components/bpel/src/main/java/org/switchyard/component/bpel/riftsaw/RiftsawBPELExchangeHandlerFactory.java
new file mode 100644
index 000000000..a08f2b44f
--- /dev/null
+++ b/components/bpel/src/main/java/org/switchyard/component/bpel/riftsaw/RiftsawBPELExchangeHandlerFactory.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpel.riftsaw;
+
+import org.switchyard.ServiceDomain;
+import org.switchyard.component.bpel.exchange.BPELExchangeHandler;
+import org.switchyard.component.bpel.exchange.BPELExchangeHandlerFactory;
+
+/**
+ * The factory for RiftsawBPELExchangeHandler.
+ */
+public class RiftsawBPELExchangeHandlerFactory extends BPELExchangeHandlerFactory {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public BPELExchangeHandler newBPELExchangeHandler(ServiceDomain serviceDomain) {
+ return new RiftsawBPELExchangeHandler(serviceDomain);
+ }
+
+}
diff --git a/components/bpel/src/main/java/org/switchyard/component/bpel/riftsaw/RiftsawServiceLocator.java b/components/bpel/src/main/java/org/switchyard/component/bpel/riftsaw/RiftsawServiceLocator.java
new file mode 100644
index 000000000..e0b84f759
--- /dev/null
+++ b/components/bpel/src/main/java/org/switchyard/component/bpel/riftsaw/RiftsawServiceLocator.java
@@ -0,0 +1,324 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpel.riftsaw;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPFault;
+
+import org.jboss.logging.Logger;
+import org.riftsaw.engine.Fault;
+import org.riftsaw.engine.Service;
+import org.riftsaw.engine.ServiceLocator;
+import org.switchyard.Exchange;
+import org.switchyard.ExchangePattern;
+import org.switchyard.ExchangeState;
+import org.switchyard.Message;
+import org.switchyard.Scope;
+import org.switchyard.ServiceDomain;
+import org.switchyard.ServiceReference;
+import org.switchyard.component.bpel.BPELFault;
+import org.switchyard.config.model.implementation.bpel.BPELComponentImplementationModel;
+import org.switchyard.component.bpel.BPELLogger;
+import org.switchyard.component.bpel.BPELMessages;
+import org.switchyard.component.common.DeliveryException;
+import org.switchyard.component.common.SynchronousInOutHandler;
+import org.switchyard.component.common.label.EndpointLabel;
+import org.switchyard.config.model.composite.ComponentReferenceModel;
+import org.switchyard.deploy.ComponentNames;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * This class implements the service locator interface to retrieve a
+ * reference to an external service (provided by switchyard) for use
+ * by a BPEL process instance.
+ *
+ */
+public class RiftsawServiceLocator implements ServiceLocator {
+
+ private static final Logger LOG = Logger.getLogger(RiftsawServiceLocator.class);
+
+ private static final long DEFAULT_TIMEOUT = 120000;
+
+ private Map _serviceDomains = new HashMap();
+ private java.util.Map _registry=new java.util.HashMap();
+ private long _waitTimeout = DEFAULT_TIMEOUT;
+
+ /**
+ * This is the constructor for the riftsaw service locator.
+ *
+ */
+ public RiftsawServiceLocator() {
+ }
+
+ /**
+ * Add a service -> service domain mapping.
+ * @param serviceName service name
+ * @param serviceDomain The service domain
+ */
+ public void addServiceDomain(QName serviceName, ServiceDomain serviceDomain) {
+ _serviceDomains.put(serviceName, serviceDomain);
+ }
+
+ /**
+ * Remove a service -> service domain mapping.
+ * @param serviceName the service name
+ */
+ public void removeServiceDomain(QName serviceName) {
+ _serviceDomains.remove(serviceName);
+ }
+
+ /**
+ * This method returns the service domain for a given service.
+ * @param serviceName service name
+ * @return The service domain
+ */
+ public ServiceDomain getServiceDomain(QName serviceName) {
+ return _serviceDomains.get(serviceName);
+ }
+
+ /**
+ * This method returns the service associated with the supplied
+ * process, service and port.
+ *
+ * @param processName The process name
+ * @param serviceName The service name
+ * @param portName The port name
+ * @return The service or null if not found
+ */
+ public Service getService(QName processName, QName serviceName, String portName) {
+ // Currently need to just use the local part, without the version number, to
+ // lookup the registry entry
+ int index=processName.getLocalPart().indexOf('-');
+ QName localProcessName=new QName(processName.getNamespaceURI(),
+ processName.getLocalPart().substring(0, index));
+
+ RegistryEntry re=_registry.get(localProcessName);
+
+ if (re == null) {
+ BPELLogger.ROOT_LOGGER.noServiceReferencesFoundForProcess(localProcessName.toString());
+ return (null);
+ }
+
+ Service ret=re.getService(serviceName, portName, _serviceDomains.get(serviceName));
+
+ if (ret == null) {
+ BPELLogger.ROOT_LOGGER.noServiceFoundFor(serviceName.toString(), portName);
+ }
+
+ return (ret);
+ }
+
+ /**
+ * This method registers a component reference against the service BPEL
+ * process, for use when it calls out to the external service.
+ *
+ * @param crm The component reference
+ */
+ public void initialiseReference(ComponentReferenceModel crm) {
+
+ // Find the BPEL implementation associated with the reference
+ if (crm.getComponent() != null
+ && crm.getComponent().getImplementation() instanceof BPELComponentImplementationModel) {
+ BPELComponentImplementationModel impl=
+ (BPELComponentImplementationModel)crm.getComponent().getImplementation();
+
+ QName processName=impl.getProcessQName();
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Register reference "+crm.getName()+" ("+crm.getQName()+") for process "+processName);
+ }
+
+ RegistryEntry re=_registry.get(processName);
+
+ if (re == null) {
+ re = new RegistryEntry();
+ _registry.put(processName, re);
+ }
+
+ javax.wsdl.Definition wsdl=WSDLHelper.getWSDLDefinition(crm.getInterface().getInterface());
+ javax.wsdl.PortType portType=WSDLHelper.getPortType(crm.getInterface().getInterface(), wsdl);
+
+ re.register(portType, crm.getQName(), crm.getComponent().getQName());
+
+ } else {
+ throw BPELMessages.MESSAGES.couldNotFindBPELImplementationAssociatedWithReference();
+ }
+
+ }
+
+ /**
+ * This class provides a registry entry for use in looking up the
+ * appropriate service to use for an external BPEL invoke.
+ *
+ */
+ public class RegistryEntry {
+
+ private java.util.List _portTypes=
+ new java.util.Vector();
+ private java.util.List _services=
+ new java.util.Vector();
+
+ private QName _componentName;
+
+ /**
+ * This method registers the wsdl, port type and service details.
+ *
+ * @param portType The port type
+ * @param service The SwitchYard service
+ * @param componentName the service component name for this registry entry
+ */
+ public void register(javax.wsdl.PortType portType, QName service, QName componentName) {
+ _portTypes.add(portType);
+ _services.add(service);
+ _componentName = componentName;
+ }
+
+ /**
+ * This method returns the service associated with the supplied service and
+ * port names.
+ *
+ * @param serviceName The service name
+ * @param portName The port name
+ * @param serviceDomain The service domain
+ * @return The service or null if not found
+ */
+ public Service getService(QName serviceName, String portName, ServiceDomain serviceDomain) {
+ Service ret = null;
+ for (int index = 0, count = _services.size(); index < count; ++index) {
+ if (serviceName.equals(_services.get(index))) {
+ QName refName = ComponentNames.qualify(_componentName, serviceName);
+ ServiceReference sref = serviceDomain.getServiceReference(refName);
+ if (sref != null) {
+ ret = new ServiceProxy(sref, _portTypes.get(index));
+ }
+ break;
+ }
+ }
+ if (ret == null) {
+ BPELLogger.ROOT_LOGGER.noServiceFoundFor(serviceName.toString());
+ }
+ return ret;
+ }
+ }
+
+ /**
+ * This class represents a service proxy, used by the BPEL engine to invoke
+ * and external service. The proxy intercepts the request and applies
+ * it to the appropriate switchyard service.
+ *
+ */
+ public class ServiceProxy implements Service {
+
+ private ServiceReference _serviceReference=null;
+ private javax.wsdl.PortType _portType=null;
+
+ /**
+ * The constructor for the service proxy.
+ *
+ * @param sref The service reference
+ * @param portType The port type
+ */
+ public ServiceProxy(ServiceReference sref, javax.wsdl.PortType portType) {
+ _serviceReference = sref;
+ _portType = portType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Element invoke(String operationName, Element mesg,
+ Map headers) throws Exception {
+
+ // Unwrap the first two levels, to remove the part wrapper
+ Node node=WSDLHelper.unwrapMessagePart(mesg);
+
+ // Need to create an exchange
+ SynchronousInOutHandler rh = new SynchronousInOutHandler();
+ Exchange exchange=_serviceReference.createExchange(operationName, rh);
+
+ Message req = exchange.createMessage();
+ req.setContent(node);
+ if (headers != null) {
+
+ for (Map.Entry e : headers.entrySet()) {
+ exchange.getContext(req).setProperty(e.getKey(), headers.get(e.getKey())).addLabels(EndpointLabel.SOAP.label());
+
+ }
+
+ // Clear the headers in preparation for response headers
+ headers.clear();
+ }
+
+ exchange.send(req);
+
+ javax.wsdl.Operation operation=_portType.getOperation(operationName, null, null);
+ Element newresp = null;
+ Element respelem = null;
+ if (ExchangePattern.IN_OUT.equals(exchange.getContract().getConsumerOperation().getExchangePattern())) {
+ try {
+ exchange = rh.waitForOut(_waitTimeout);
+ } catch (DeliveryException e) {
+ throw BPELMessages.MESSAGES.timedOutAfterMsWaitingOnSynchronousResponseFromTargetService(_waitTimeout, _serviceReference.getName().toString());
+ }
+
+ Message resp=exchange.getMessage();
+
+ if (resp == null) {
+ throw BPELMessages.MESSAGES.responseNotReturnedFromOperationOnService(operationName, _serviceReference.getName().toString());
+ }
+
+ // Process header values associated with the response
+ for (org.switchyard.Property p : exchange.getContext().getProperties(Scope.MESSAGE)) {
+ if (p.hasLabel(EndpointLabel.SOAP.label())) {
+ headers.put(p.getName(), p.getValue());
+ }
+ }
+
+ // Check for exception - but don't rethrow a BPEL
+ // fault as it will be converted to a message
+ // response
+ if (resp.getContent() instanceof Exception
+ && !(resp.getContent() instanceof BPELFault)) {
+ throw (Exception)resp.getContent();
+ }
+
+ respelem = (Element)resp.getContent(Node.class);
+ newresp=WSDLHelper.wrapResponseMessagePart(respelem, operation);
+
+ }
+
+ if (exchange.getState() == ExchangeState.FAULT) {
+ QName faultCode=null;
+
+ if ((respelem != null) && (respelem instanceof SOAPFault)) {
+ SOAPFault fault=(SOAPFault)respelem;
+
+ respelem = (Element)fault.getDetail().getFirstChild();
+
+ faultCode = fault.getFaultCodeAsQName();
+ }
+
+ Element newfault=WSDLHelper.wrapFaultMessagePart(respelem, operation, null);
+ throw new Fault(faultCode, newfault);
+ }
+
+ return ((Element)newresp);
+ }
+ }
+
+}
diff --git a/components/bpel/src/main/java/org/switchyard/component/bpel/riftsaw/SwitchYardPropertyFunction.java b/components/bpel/src/main/java/org/switchyard/component/bpel/riftsaw/SwitchYardPropertyFunction.java
new file mode 100644
index 000000000..b3a5a9959
--- /dev/null
+++ b/components/bpel/src/main/java/org/switchyard/component/bpel/riftsaw/SwitchYardPropertyFunction.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpel.riftsaw;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.xml.namespace.QName;
+
+import org.switchyard.common.property.PropertyResolver;
+
+/**
+ * The custom XPath function which resolves SwitchYard properties referenced from BPEL process definition.
+ */
+public final class SwitchYardPropertyFunction {
+
+ private static final Map PROPERTY_RESOLVERS = new HashMap();
+
+ private SwitchYardPropertyFunction() {}
+
+ /**
+ * Sets PropertyResolver instance.
+ * @param processName BPEL process QName
+ * @param resolver PropertyResolver instance
+ */
+ public static final void setPropertyResolver(QName processName, PropertyResolver resolver) {
+ PROPERTY_RESOLVERS.put(processName, resolver);
+ }
+
+ /**
+ * Removes a PropertyResolver for the specified process.
+ * @param processName BPEL process QName
+ */
+ public static final void removePropertyResolver(QName processName) {
+ PROPERTY_RESOLVERS.remove(processName);
+ }
+
+ /**
+ * Resolves a property.
+ * @param processName BPEL process QName
+ * @param key property name
+ * @return property value
+ */
+ public static final Object resolveProperty(QName processName, Object key) {
+ PropertyResolver resolver = PROPERTY_RESOLVERS.get(processName);
+ if (resolver == null) {
+ return null;
+ }
+ return resolver.resolveProperty(key.toString());
+ }
+}
diff --git a/components/bpel/src/main/java/org/switchyard/component/bpel/riftsaw/WSDLHelper.java b/components/bpel/src/main/java/org/switchyard/component/bpel/riftsaw/WSDLHelper.java
new file mode 100644
index 000000000..f925a4b1d
--- /dev/null
+++ b/components/bpel/src/main/java/org/switchyard/component/bpel/riftsaw/WSDLHelper.java
@@ -0,0 +1,277 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpel.riftsaw;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.switchyard.SwitchYardException;
+import org.switchyard.component.bpel.BPELMessages;
+import org.w3c.dom.Element;
+
+/**
+ * WSDL Helper.
+ *
+ */
+public final class WSDLHelper {
+
+ private static final Logger LOG = Logger.getLogger(WSDLHelper.class);
+
+ private static final String WSDL_PORTTYPE_PREFIX = "#wsdl.porttype(";
+
+ private WSDLHelper() {
+ }
+
+ /**
+ * This method returns the WSDL definition defined by the location.
+ *
+ * @param location the location
+ * @return The WSDL definition or null if not found
+ * @throws SwitchYardException Failed to locate WSDL
+ */
+ public static javax.wsdl.Definition getWSDLDefinition(String location) throws SwitchYardException {
+ javax.wsdl.Definition ret=null;
+
+ if (location == null) {
+ throw BPELMessages.MESSAGES.wSDLLocationHasNotBeenSpecified();
+ } else {
+ try {
+ int index=location.indexOf('#');
+
+ if (index != -1) {
+ location = location.substring(0, index);
+ }
+
+ java.net.URL url=Thread.currentThread().getContextClassLoader().getResource(location);
+
+ ret = javax.wsdl.factory.WSDLFactory.newInstance().newWSDLReader().readWSDL(url.toString());
+
+ } catch (Exception e) {
+ throw BPELMessages.MESSAGES.failedToLoadWSDL(location, e);
+ }
+ }
+
+ return (ret);
+ }
+
+ /**
+ * This method returns the port type associated with the supplied wsdl and location.
+ *
+ * @param location The location
+ * @param wsdl The wsdl
+ * @return The port type
+ * @throws SwitchYardException Failed to get port type
+ */
+ public static javax.wsdl.PortType getPortType(String location, javax.wsdl.Definition wsdl)
+ throws SwitchYardException {
+ javax.wsdl.PortType ret=null;
+
+ if (location == null) {
+ throw BPELMessages.MESSAGES.wSDLLocationHasNotBeenSpecified();
+ } else {
+ int index=location.indexOf(WSDL_PORTTYPE_PREFIX);
+
+ if (index != -1) {
+ String portTypeName = location.substring(index+WSDL_PORTTYPE_PREFIX.length(), location.length() - 1);
+
+ ret = wsdl.getPortType(new QName(wsdl.getTargetNamespace(), portTypeName));
+ }
+ }
+
+ return (ret);
+ }
+
+ /**
+ * This method returns the service associated with the supplied port type from the
+ * supplied WSDL.
+ *
+ * @param portType The port type
+ * @param wsdl The wsdl
+ * @return The service, or null if not found
+ */
+ public static javax.wsdl.Service getServiceForPortType(javax.wsdl.PortType portType,
+ javax.wsdl.Definition wsdl) {
+ javax.wsdl.Service ret=null;
+
+ java.util.Iterator> iter=wsdl.getServices().values().iterator();
+ while (ret == null && iter.hasNext()) {
+ ret = (javax.wsdl.Service)iter.next();
+
+ java.util.Iterator> ports=ret.getPorts().values().iterator();
+ boolean f_found=false;
+
+ while (!f_found && ports.hasNext()) {
+ javax.wsdl.Port port=(javax.wsdl.Port)ports.next();
+
+ if (port.getBinding().getPortType() == portType) {
+ f_found = true;
+ }
+ }
+
+ if (!f_found) {
+ ret = null;
+ }
+ }
+
+ return (ret);
+ }
+
+ /**
+ * This method removes the message content from its part wrapper.
+ *
+ * @param content The wrapped part
+ * @return The unwrapped content
+ */
+ public static org.w3c.dom.Node unwrapMessagePart(org.w3c.dom.Element content) {
+
+ org.w3c.dom.NodeList nl=content.getChildNodes();
+
+ for (int i=0; i < nl.getLength(); i++) {
+
+ if (nl.item(i) instanceof org.w3c.dom.Element) {
+
+ org.w3c.dom.NodeList nl2=((org.w3c.dom.Element)nl.item(i)).getChildNodes();
+
+ for (int j=0; j < nl2.getLength(); j++) {
+
+ if (nl2.item(j) instanceof org.w3c.dom.Element) {
+ return ((org.w3c.dom.Node)nl2.item(j));
+ }
+ }
+
+ if (nl2.getLength() > 0) {
+ return (nl2.item(0));
+ }
+
+ return (null);
+ }
+ }
+
+ return (null);
+ }
+
+ /**
+ * This method wraps a request message content in a part wrapper.
+ *
+ * @param content The message
+ * @param operation The operation
+ * @return The part wrapper associated with the operation
+ */
+ public static org.w3c.dom.Element wrapRequestMessagePart(org.w3c.dom.Element content,
+ javax.wsdl.Operation operation) {
+ return (wrapMessagePart(content, operation, operation.getInput().getMessage().getParts(), false));
+ }
+
+ /**
+ * This method wraps a response message content in a part wrapper.
+ *
+ * @param content The message
+ * @param operation The operation
+ * @return The part wrapper associated with the operation
+ */
+ public static org.w3c.dom.Element wrapResponseMessagePart(org.w3c.dom.Element content,
+ javax.wsdl.Operation operation) {
+ return (wrapMessagePart(content, operation, operation.getOutput().getMessage().getParts(), false));
+ }
+
+ /**
+ * This method wraps a fault message content in a part wrapper.
+ *
+ * @param content The message
+ * @param operation The operation
+ * @param faultName The fault
+ * @return The part wrapper associated with the operation and fault
+ */
+ public static org.w3c.dom.Element wrapFaultMessagePart(org.w3c.dom.Element content,
+ javax.wsdl.Operation operation, String faultName) {
+ java.util.Map, ?> parts=null;
+
+ if (faultName != null) {
+ javax.wsdl.Fault fault=operation.getFault(faultName);
+
+ if (fault == null) {
+ throw BPELMessages.MESSAGES.unableToFindFaultOn(faultName, operation.getName());
+ }
+
+ parts = fault.getMessage().getParts();
+ } else {
+ // Need to iterate through faults to determine which has a part with the
+ // appropriate element type
+ @SuppressWarnings({ "unchecked" })
+ java.util.Iterator iter=
+ (java.util.Iterator)operation.getFaults().values().iterator();
+
+ while (parts == null && iter.hasNext()) {
+ javax.wsdl.Fault fault=iter.next();
+
+ if (fault.getMessage().getParts().size() == 1) {
+ javax.wsdl.Part part=(javax.wsdl.Part)fault.getMessage().getParts().values().iterator().next();
+
+ if (part.getElementName() != null
+ && content.getLocalName().equals(part.getElementName().getLocalPart())
+ && content.getNamespaceURI().equals(part.getElementName().getNamespaceURI())) {
+
+ parts = fault.getMessage().getParts();
+ }
+ }
+ }
+ }
+
+ return (wrapMessagePart(content, operation, parts, true));
+ }
+
+ /**
+ * This method wraps a message content in a part wrapper.
+ *
+ * @param content The message
+ * @param operation The operation
+ * @param parts The parts map
+ * @param fault Whether dealing with a fault
+ * @return The part wrapper associated with the operation
+ */
+ protected static org.w3c.dom.Element wrapMessagePart(org.w3c.dom.Element content,
+ javax.wsdl.Operation operation, java.util.Map, ?> parts, boolean fault) {
+ org.w3c.dom.Element ret=content.getOwnerDocument().createElement("message");
+ String partName=null;
+
+ // Find part name from content type for the operation
+ if (parts != null) {
+ if (parts.size() != 1) {
+ throw BPELMessages.MESSAGES.onlyExpectingASingleMessagePartForOperation(operation.getName());
+ }
+
+ partName = (String)parts.keySet().iterator().next();
+ }
+
+ if (partName == null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("No part found for operation: "+operation+" and content: "+content);
+ }
+
+ if (!fault) {
+ throw BPELMessages.MESSAGES.unableToFindPartNameFor(operation.getName());
+ }
+
+ // Assume that this represents an undeclared fault, and therefore return as an
+ // element instead of a message (RIFTSAW-516)
+ return (content);
+ }
+
+ Element part=ret.getOwnerDocument().createElement(partName);
+ ret.appendChild(part);
+ part.appendChild(content);
+
+ return (ret);
+ }
+}
diff --git a/components/bpel/src/main/resources/META-INF/services/org.switchyard.component.bpel.exchange.BPELExchangeHandlerFactory b/components/bpel/src/main/resources/META-INF/services/org.switchyard.component.bpel.exchange.BPELExchangeHandlerFactory
new file mode 100644
index 000000000..f4687b9a6
--- /dev/null
+++ b/components/bpel/src/main/resources/META-INF/services/org.switchyard.component.bpel.exchange.BPELExchangeHandlerFactory
@@ -0,0 +1,12 @@
+# Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+org.switchyard.component.bpel.riftsaw.RiftsawBPELExchangeHandlerFactory
diff --git a/components/bpel/src/main/resources/META-INF/services/org.switchyard.deploy.Component b/components/bpel/src/main/resources/META-INF/services/org.switchyard.deploy.Component
new file mode 100644
index 000000000..64eba2563
--- /dev/null
+++ b/components/bpel/src/main/resources/META-INF/services/org.switchyard.deploy.Component
@@ -0,0 +1,12 @@
+# Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+org.switchyard.component.bpel.deploy.BPELComponent
diff --git a/components/bpel/src/main/resources/META-INF/switchyard/transforms.xml b/components/bpel/src/main/resources/META-INF/switchyard/transforms.xml
new file mode 100644
index 000000000..a3e5d0d00
--- /dev/null
+++ b/components/bpel/src/main/resources/META-INF/switchyard/transforms.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpel/src/main/resources/bpel.properties b/components/bpel/src/main/resources/bpel.properties
new file mode 100644
index 000000000..d3776d401
--- /dev/null
+++ b/components/bpel/src/main/resources/bpel.properties
@@ -0,0 +1,68 @@
+#
+# 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.
+#
+
+## bpel Configuration Properties
+
+bpel.dao.factory=org.apache.ode.dao.jpa.hibernate.BpelDAOConnectionFactoryImpl
+bpel.dao.factory.store=org.apache.ode.dao.jpa.hibernate.ConfStoreDAOConnectionFactoryImpl
+bpel.dao.factory.scheduler=org.apache.ode.dao.jpa.hibernate.SchedulerDAOConnectionFactoryImpl
+bpel.cache.provider=org.riftsaw.engine.internal.InfinispanCacheProvider
+
+bpel.tx.factory.class = org.riftsaw.engine.jboss.JBossTransactionFactory
+
+bpel.db.mode=EMBEDDED
+db.emb.create=false
+bpel.db.ext.dataSource=java:BPELDB
+
+# all hibernate specific properties
+
+hibernate.dialect=org.hibernate.dialect.H2Dialect
+hibernate.hbm2ddl.auto=none
+hibernate.current_session_context_class=jta
+hibernate.show_sql=false
+hibernate.connection.isolation=2
+hibernate.jdbc.batch_size=20
+
+jta.UserTransaction=UserTransaction
+
+ode.persistence=hibernate
+
+#
+# Comma separated list of BPEL event listeners.
+# BPAFLogAdapter is used to store BPEL events for historic analysis.
+#
+bpel.event.listeners=org.jboss.soa.bpel.console.bpaf.BPAFLogAdapter
+#bpel.event.listeners=
+
+# Property used to configure whether ODE should store the BPEL events in its default location
+# (Set to false, as RiftSaw uses the BPEL events stored by the BPAFLogAdapter)
+persist.bpel.events = false
+
+# Determines if even top level transaction based ODE invokes should bypass the scheduler
+# If false, then top level invokes will be scheduled, but subsequent nested invokes (to
+# external services in same thread) will be directly invoked instead of via the scheduler.
+# NOTE: Currently disabled, as the mechanism bypasses the mex.timeout guard and also has
+# issues when dealing with correlation, where messages are received out of order.
+#bpel.invoke.immediate=false
+
+#Configure the scheduler node name
+bpel.riftsaw.node.name=riftsaw-scheduler-node
+
+#Configure the cache name from the infinispan module for the ProcessConf cache
+bpel.cache-name=cluster
diff --git a/components/bpel/src/test/java/org/switchyard/component/bpel/riftsaw/BPELInOnlyLocatorTest.java b/components/bpel/src/test/java/org/switchyard/component/bpel/riftsaw/BPELInOnlyLocatorTest.java
new file mode 100644
index 000000000..8671f694b
--- /dev/null
+++ b/components/bpel/src/test/java/org/switchyard/component/bpel/riftsaw/BPELInOnlyLocatorTest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpel.riftsaw;
+
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+import org.switchyard.test.SwitchYardTestCaseConfig;
+import org.switchyard.test.SwitchYardTestKit;
+import org.switchyard.component.test.mixins.cdi.CDIMixIn;
+import org.switchyard.component.test.mixins.http.HTTPMixIn;
+import org.switchyard.transform.config.model.TransformSwitchYardScanner;
+
+/*
+ * This test is in response to SWITCHYARD-2311. It uses a modified version
+ * of the loan approval / risk assessment processes which do not return a response,
+ * and triggers the creation of an IN_ONLY exchange in RiftsawServiceLocator.
+ */
+@SwitchYardTestCaseConfig(
+ config = "/loan2_approval/switchyard.xml",
+ scanners = {TransformSwitchYardScanner.class },
+ mixins = {CDIMixIn.class, HTTPMixIn.class })
+public class BPELInOnlyLocatorTest {
+
+ private SwitchYardTestKit _testKit;
+
+ @org.junit.Before
+ public void init() {
+ try {
+ _testKit = new SwitchYardTestKit(this);
+ _testKit.start();
+ } catch(Exception e) {
+ e.printStackTrace();
+ fail("Unable to initialize testkit: "+ e);
+ }
+ }
+
+ @org.junit.After
+ public void close() {
+ if (_testKit != null) {
+ try {
+ _testKit.cleanup();
+ } catch(Exception e) {
+ e.printStackTrace();
+ fail("Unable to cleanup testkit: "+ e);
+ }
+ }
+ }
+
+ @Test
+ public void sendLoanRequest1() throws Exception {
+ String msg = ""
+ + ""
+ + ""
+ + "Fred "
+ + "Bloggs "
+ + "100 "
+ + " "
+ + " ";
+
+ String result = _testKit.getMixIn(HTTPMixIn.class).
+ postResourceAndTestXML("http://localhost:18001/loan2Service",
+ "/loan2_approval/soap-loanreq1.xml", "/loan2_approval/soap-loanresp1.xml");
+ }
+
+}
diff --git a/components/bpel/src/test/java/org/switchyard/component/bpel/riftsaw/BPELLoanApprovalTest.java b/components/bpel/src/test/java/org/switchyard/component/bpel/riftsaw/BPELLoanApprovalTest.java
new file mode 100644
index 000000000..7d72a603d
--- /dev/null
+++ b/components/bpel/src/test/java/org/switchyard/component/bpel/riftsaw/BPELLoanApprovalTest.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpel.riftsaw;
+
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+import org.switchyard.test.SwitchYardTestCaseConfig;
+import org.switchyard.test.SwitchYardTestKit;
+import org.switchyard.component.test.mixins.cdi.CDIMixIn;
+import org.switchyard.component.test.mixins.http.HTTPMixIn;
+import org.switchyard.transform.config.model.TransformSwitchYardScanner;
+
+@SwitchYardTestCaseConfig(
+ config = "/loan_approval/switchyard.xml",
+ scanners = {TransformSwitchYardScanner.class },
+ mixins = {CDIMixIn.class, HTTPMixIn.class })
+public class BPELLoanApprovalTest {
+
+ private SwitchYardTestKit _testKit;
+
+ @org.junit.Before
+ public void init() {
+ try {
+ _testKit = new SwitchYardTestKit(this);
+ _testKit.start();
+ } catch(Exception e) {
+ e.printStackTrace();
+ fail("Unable to initialize testkit: "+ e);
+ }
+ }
+
+ @org.junit.After
+ public void close() {
+ if (_testKit != null) {
+ try {
+ _testKit.cleanup();
+ } catch(Exception e) {
+ e.printStackTrace();
+ fail("Unable to cleanup testkit: "+ e);
+ }
+ }
+ }
+
+ @Test
+ public void sendLoanRequest1() throws Exception {
+ _testKit.getMixIn(HTTPMixIn.class).
+ postResourceAndTestXML("http://localhost:18001/loanService",
+ "/loan_approval/soap-loanreq1.xml", "/loan_approval/soap-loanresp1.xml");
+ }
+
+
+ @Test
+ public void sendLoanRequest2() throws Exception {
+ _testKit.getMixIn(HTTPMixIn.class).
+ postResourceAndTestXML("http://localhost:18001/loanService",
+ "/loan_approval/soap-loanreq2.xml", "/loan_approval/soap-loanresp2.xml");
+ }
+}
diff --git a/components/bpel/src/test/java/org/switchyard/component/bpel/riftsaw/BPELSayHelloTest.java b/components/bpel/src/test/java/org/switchyard/component/bpel/riftsaw/BPELSayHelloTest.java
new file mode 100644
index 000000000..3ae67d13b
--- /dev/null
+++ b/components/bpel/src/test/java/org/switchyard/component/bpel/riftsaw/BPELSayHelloTest.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpel.riftsaw;
+
+import org.junit.Test;
+import org.switchyard.test.SwitchYardTestKit;
+
+import static org.junit.Assert.*;
+
+import org.switchyard.test.SwitchYardTestCaseConfig;
+import org.switchyard.component.test.mixins.cdi.CDIMixIn;
+import org.switchyard.component.test.mixins.http.HTTPMixIn;
+import org.switchyard.transform.config.model.TransformSwitchYardScanner;
+
+@SwitchYardTestCaseConfig(
+ config = "/say_hello/switchyard.xml",
+ scanners = {TransformSwitchYardScanner.class },
+ mixins = {CDIMixIn.class, HTTPMixIn.class })
+public class BPELSayHelloTest {
+
+ private SwitchYardTestKit _testKit;
+
+ @org.junit.Before
+ public void init() {
+ try {
+ _testKit = new SwitchYardTestKit(this);
+ _testKit.start();
+ } catch(Exception e) {
+ fail("Unable to initialize testkit");
+ }
+ }
+
+ @org.junit.After
+ public void close() {
+ if (_testKit != null) {
+ try {
+ _testKit.cleanup();
+ } catch(Exception e) {
+ e.printStackTrace();
+ fail("Unable to cleanup testkit: "+ e);
+ }
+ }
+ }
+
+ @Test
+ public void invokeSayHelloService() throws Exception {
+ _testKit.getMixIn(HTTPMixIn.class).
+ postResourceAndTestXML("http://localhost:18001/SayHelloService",
+ "/say_hello/soap-request.xml", "/say_hello/soap-response.xml");
+ }
+}
diff --git a/components/bpel/src/test/java/org/switchyard/component/bpel/riftsaw/WSDLHelperTest.java b/components/bpel/src/test/java/org/switchyard/component/bpel/riftsaw/WSDLHelperTest.java
new file mode 100644
index 000000000..b73cabead
--- /dev/null
+++ b/components/bpel/src/test/java/org/switchyard/component/bpel/riftsaw/WSDLHelperTest.java
@@ -0,0 +1,262 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpel.riftsaw;
+
+import static org.junit.Assert.*;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ode.utils.DOMUtils;
+import org.junit.Test;
+import org.w3c.dom.Text;
+
+public class WSDLHelperTest {
+
+ @Test
+ public void testUnwrapMessagePart() {
+ String content="content";
+ String xml="<"+content+"/> ";
+
+ try {
+ org.w3c.dom.Element elem=DOMUtils.stringToDOM(xml);
+
+ org.w3c.dom.Node unwrapped=WSDLHelper.unwrapMessagePart(elem);
+
+ if (unwrapped == null) {
+ fail("Result is null");
+ }
+
+ if (unwrapped.getNodeName().equals(content) == false) {
+ fail("Unexpected unwrapped content: "+unwrapped.getNodeName());
+ }
+ } catch(Exception e) {
+ fail("Failed: "+e);
+ }
+ }
+
+ @Test
+ public void testUnwrapMessagePartText() {
+ String content="content";
+ String xml=""+content+" ";
+
+ try {
+ org.w3c.dom.Element elem=DOMUtils.stringToDOM(xml);
+
+ org.w3c.dom.Node unwrapped=WSDLHelper.unwrapMessagePart(elem);
+
+ if (unwrapped == null) {
+ fail("Result is null");
+ }
+
+ if (!(unwrapped instanceof Text)) {
+ fail("Context was not Text");
+ }
+
+ if (((Text)unwrapped).getTextContent().equals(content) == false) {
+ fail("Unexpected unwrapped content: "+((Text)unwrapped).getTextContent());
+ }
+ } catch(Exception e) {
+ fail("Failed: "+e);
+ }
+ }
+
+ @Test
+ public void testUnwrapMessagePartWhitespace() {
+ String content="content";
+ String xml="\r\n <"+content+"/>\r\n ";
+
+ try {
+ org.w3c.dom.Element elem=DOMUtils.stringToDOM(xml);
+
+ org.w3c.dom.Node unwrapped=WSDLHelper.unwrapMessagePart(elem);
+
+ if (unwrapped == null) {
+ fail("Result is null");
+ }
+
+ if (unwrapped.getNodeName().equals(content) == false) {
+ fail("Unexpected unwrapped content: "+unwrapped.getNodeName());
+ }
+ } catch(Exception e) {
+ fail("Failed: "+e);
+ }
+ }
+
+ @Test
+ public void testWrapRequestMessagePart() {
+ try {
+ java.net.URL url=WSDLHelperTest.class.getResource("/tests/wsdl/LoanService.wsdl");
+
+ javax.wsdl.Definition wsdl=javax.wsdl.factory.WSDLFactory.newInstance().newWSDLReader().readWSDL(url.getFile());
+
+ javax.wsdl.PortType portType=
+ wsdl.getPortType(QName.valueOf("{http://example.com/loan-approval/loanService/}loanServicePT"));
+ if (portType == null) {
+ fail("Unable to get port type");
+ }
+
+ javax.wsdl.Operation op=portType.getOperation("request", null, null);
+
+ if (op == null) {
+ fail("Unable to get operation 'request'");
+ }
+
+ String content="content";
+ String xml="<"+content+"/>";
+
+ org.w3c.dom.Element elem=DOMUtils.stringToDOM(xml);
+
+ org.w3c.dom.Element wrapped=WSDLHelper.wrapRequestMessagePart(elem, op);
+
+ if (wrapped == null) {
+ fail("Result is null");
+ }
+
+ if (wrapped.getFirstChild().getNodeName().equals("reqpart") == false) {
+ fail("Part name was not 'reqpart': "+wrapped.getFirstChild().getNodeName());
+ }
+
+ if (wrapped.getFirstChild().getFirstChild().getNodeName().equals(content) == false) {
+ fail("Content was not '"+content+"': "+wrapped.getFirstChild().getFirstChild().getNodeName());
+ }
+ } catch(Exception e) {
+ fail("Failed: "+e);
+ }
+ }
+
+ @Test
+ public void testWrapResponseMessagePart() {
+ try {
+ java.net.URL url=WSDLHelperTest.class.getResource("/tests/wsdl/LoanService.wsdl");
+
+ javax.wsdl.Definition wsdl=javax.wsdl.factory.WSDLFactory.newInstance().newWSDLReader().readWSDL(url.getFile());
+
+ javax.wsdl.PortType portType=
+ wsdl.getPortType(QName.valueOf("{http://example.com/loan-approval/loanService/}loanServicePT"));
+ if (portType == null) {
+ fail("Unable to get port type");
+ }
+
+ javax.wsdl.Operation op=portType.getOperation("request", null, null);
+
+ if (op == null) {
+ fail("Unable to get operation 'request'");
+ }
+
+ String content="content";
+ String xml="<"+content+"/>";
+
+ org.w3c.dom.Element elem=DOMUtils.stringToDOM(xml);
+
+ org.w3c.dom.Element wrapped=WSDLHelper.wrapResponseMessagePart(elem, op);
+
+ if (wrapped == null) {
+ fail("Result is null");
+ }
+
+ if (wrapped.getFirstChild().getNodeName().equals("resppart") == false) {
+ fail("Part name was not 'resppart': "+wrapped.getFirstChild().getNodeName());
+ }
+
+ if (wrapped.getFirstChild().getFirstChild().getNodeName().equals(content) == false) {
+ fail("Content was not '"+content+"': "+wrapped.getFirstChild().getFirstChild().getNodeName());
+ }
+ } catch(Exception e) {
+ fail("Failed: "+e);
+ }
+ }
+
+ @Test
+ public void testWrapFaultMessagePartWithName() {
+ try {
+ java.net.URL url=WSDLHelperTest.class.getResource("/tests/wsdl/LoanService.wsdl");
+
+ javax.wsdl.Definition wsdl=javax.wsdl.factory.WSDLFactory.newInstance().newWSDLReader().readWSDL(url.getFile());
+
+ javax.wsdl.PortType portType=
+ wsdl.getPortType(QName.valueOf("{http://example.com/loan-approval/loanService/}loanServicePT"));
+ if (portType == null) {
+ fail("Unable to get port type");
+ }
+
+ javax.wsdl.Operation op=portType.getOperation("request", null, null);
+
+ if (op == null) {
+ fail("Unable to get operation 'request'");
+ }
+
+ String content="content";
+ String xml="<"+content+"/>";
+
+ org.w3c.dom.Element elem=DOMUtils.stringToDOM(xml);
+
+ org.w3c.dom.Element wrapped=WSDLHelper.wrapFaultMessagePart(elem, op, "unableToHandleRequest");
+
+ if (wrapped == null) {
+ fail("Result is null");
+ }
+
+ if (wrapped.getFirstChild().getNodeName().equals("errorCode") == false) {
+ fail("Part name was not 'errorCode': "+wrapped.getFirstChild().getNodeName());
+ }
+
+ if (wrapped.getFirstChild().getFirstChild().getNodeName().equals(content) == false) {
+ fail("Content was not '"+content+"': "+wrapped.getFirstChild().getFirstChild().getNodeName());
+ }
+ } catch(Exception e) {
+ fail("Failed: "+e);
+ }
+ }
+
+ @Test
+ public void testWrapFaultMessagePartWithoutName() {
+ try {
+ java.net.URL url=WSDLHelperTest.class.getResource("/tests/wsdl/LoanService.wsdl");
+
+ javax.wsdl.Definition wsdl=javax.wsdl.factory.WSDLFactory.newInstance().newWSDLReader().readWSDL(url.getFile());
+
+ javax.wsdl.PortType portType=
+ wsdl.getPortType(QName.valueOf("{http://example.com/loan-approval/loanService/}loanServicePT"));
+ if (portType == null) {
+ fail("Unable to get port type");
+ }
+
+ javax.wsdl.Operation op=portType.getOperation("request", null, null);
+
+ if (op == null) {
+ fail("Unable to get operation 'request'");
+ }
+
+ String xml=" ";
+
+ org.w3c.dom.Element elem=DOMUtils.stringToDOM(xml);
+
+ org.w3c.dom.Element wrapped=WSDLHelper.wrapFaultMessagePart(elem, op, null);
+
+ if (wrapped == null) {
+ fail("Result is null");
+ }
+
+ if (wrapped.getFirstChild().getNodeName().equals("errorCode") == false) {
+ fail("Part name was not 'errorCode': "+wrapped.getFirstChild().getNodeName());
+ }
+
+ if (wrapped.getFirstChild().getFirstChild().getNodeName().equals(elem.getNodeName()) == false) {
+ fail("Content was not '"+elem.getNodeName()+"': "+wrapped.getFirstChild().getFirstChild().getNodeName());
+ }
+ } catch(Exception e) {
+ fail("Failed: "+e);
+ }
+ }
+}
diff --git a/components/bpel/src/test/resources/META-INF/beans.xml b/components/bpel/src/test/resources/META-INF/beans.xml
new file mode 100644
index 000000000..e69de29bb
diff --git a/components/bpel/src/test/resources/SayHello.bpel b/components/bpel/src/test/resources/SayHello.bpel
new file mode 100644
index 000000000..a33559194
--- /dev/null
+++ b/components/bpel/src/test/resources/SayHello.bpel
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bpel-say-hello/src/main/resources/SayHelloArtifacts.wsdl b/components/bpel/src/test/resources/SayHelloArtifacts.wsdl
similarity index 100%
rename from bpel-say-hello/src/main/resources/SayHelloArtifacts.wsdl
rename to components/bpel/src/test/resources/SayHelloArtifacts.wsdl
diff --git a/components/bpel/src/test/resources/bpel.properties b/components/bpel/src/test/resources/bpel.properties
new file mode 100644
index 000000000..a84b49a9a
--- /dev/null
+++ b/components/bpel/src/test/resources/bpel.properties
@@ -0,0 +1,63 @@
+#
+# 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.
+#
+
+## bpel Configuration Properties
+
+bpel.dao.factory=org.apache.ode.dao.jpa.hibernate.BpelDAOConnectionFactoryImpl
+bpel.dao.factory.store=org.apache.ode.dao.jpa.hibernate.ConfStoreDAOConnectionFactoryImpl
+bpel.dao.factory.scheduler=org.apache.ode.dao.jpa.hibernate.SchedulerDAOConnectionFactoryImpl
+bpel.cache.provider=org.apache.ode.il.cache.DefaultCacheProvider
+
+bpel.tx.factory.class = org.apache.ode.il.EmbeddedGeronimoFactory
+
+bpel.db.mode=EMBEDDED
+db.emb.create=false
+bpel.db.ext.dataSource=java:BPELDB
+
+# all hibernate specific properties
+
+hibernate.dialect=org.hibernate.dialect.H2Dialect
+hibernate.hbm2ddl.auto=none
+hibernate.current_session_context_class=jta
+hibernate.show_sql=false
+hibernate.connection.isolation=2
+hibernate.jdbc.batch_size=20
+
+jta.UserTransaction=UserTransaction
+
+ode.persistence=hibernate
+
+#
+# Comma separated list of BPEL event listeners.
+# BPAFLogAdapter is used to store BPEL events for historic analysis.
+#
+#bpel.event.listeners=org.jboss.soa.bpel.console.bpaf.BPAFLogAdapter
+#bpel.event.listeners=
+
+# Property used to configure whether ODE should store the BPEL events in its default location
+# (Set to false, as RiftSaw uses the BPEL events stored by the BPAFLogAdapter)
+persist.bpel.events = false
+
+# Determines if even top level transaction based ODE invokes should bypass the scheduler
+# If false, then top level invokes will be scheduled, but subsequent nested invokes (to
+# external services in same thread) will be directly invoked instead of via the scheduler.
+bpel.invoke.immediate=false
+
+# Delay not set during testing
+bpel.undeploy.delay = 0
diff --git a/components/bpel/src/test/resources/deploy.xml b/components/bpel/src/test/resources/deploy.xml
new file mode 100644
index 000000000..19cfc88b4
--- /dev/null
+++ b/components/bpel/src/test/resources/deploy.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+ true
+ false
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
diff --git a/components/bpel/src/test/resources/loan2ServicePT.wsdl b/components/bpel/src/test/resources/loan2ServicePT.wsdl
new file mode 100644
index 000000000..308f7f97d
--- /dev/null
+++ b/components/bpel/src/test/resources/loan2ServicePT.wsdl
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpel/src/test/resources/loan2_approval.bpel b/components/bpel/src/test/resources/loan2_approval.bpel
new file mode 100644
index 000000000..89272a42c
--- /dev/null
+++ b/components/bpel/src/test/resources/loan2_approval.bpel
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ yes
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpel/src/test/resources/loan2_approval/soap-loanreq1.xml b/components/bpel/src/test/resources/loan2_approval/soap-loanreq1.xml
new file mode 100644
index 000000000..d135edf63
--- /dev/null
+++ b/components/bpel/src/test/resources/loan2_approval/soap-loanreq1.xml
@@ -0,0 +1,10 @@
+
+
+
+
+ Fred
+ Bloggs
+ 100
+
+
+
diff --git a/components/bpel/src/test/resources/loan2_approval/soap-loanresp1.xml b/components/bpel/src/test/resources/loan2_approval/soap-loanresp1.xml
new file mode 100644
index 000000000..263b70a4f
--- /dev/null
+++ b/components/bpel/src/test/resources/loan2_approval/soap-loanresp1.xml
@@ -0,0 +1,3 @@
+
+ yes
+
diff --git a/components/bpel/src/test/resources/loan2_approval/switchyard.xml b/components/bpel/src/test/resources/loan2_approval/switchyard.xml
new file mode 100644
index 000000000..c1efacc81
--- /dev/null
+++ b/components/bpel/src/test/resources/loan2_approval/switchyard.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+ loan2ServicePT.wsdl
+ localhost:18001
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bpel-loan-approval/src/main/resources/loanServicePT.wsdl b/components/bpel/src/test/resources/loanServicePT.wsdl
similarity index 100%
rename from bpel-loan-approval/src/main/resources/loanServicePT.wsdl
rename to components/bpel/src/test/resources/loanServicePT.wsdl
diff --git a/components/bpel/src/test/resources/loan_approval.bpel b/components/bpel/src/test/resources/loan_approval.bpel
new file mode 100644
index 000000000..7a87556e6
--- /dev/null
+++ b/components/bpel/src/test/resources/loan_approval.bpel
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ yes
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpel/src/test/resources/loan_approval/soap-loanreq1.xml b/components/bpel/src/test/resources/loan_approval/soap-loanreq1.xml
new file mode 100644
index 000000000..4be1ad5ee
--- /dev/null
+++ b/components/bpel/src/test/resources/loan_approval/soap-loanreq1.xml
@@ -0,0 +1,10 @@
+
+
+
+
+ Fred
+ Bloggs
+ 100
+
+
+
\ No newline at end of file
diff --git a/components/bpel/src/test/resources/loan_approval/soap-loanreq2.xml b/components/bpel/src/test/resources/loan_approval/soap-loanreq2.xml
new file mode 100644
index 000000000..fddd084d3
--- /dev/null
+++ b/components/bpel/src/test/resources/loan_approval/soap-loanreq2.xml
@@ -0,0 +1,10 @@
+
+
+
+
+ Fred
+ Bloggs
+ 11000
+
+
+
diff --git a/components/bpel/src/test/resources/loan_approval/soap-loanresp1.xml b/components/bpel/src/test/resources/loan_approval/soap-loanresp1.xml
new file mode 100644
index 000000000..a9bc361d7
--- /dev/null
+++ b/components/bpel/src/test/resources/loan_approval/soap-loanresp1.xml
@@ -0,0 +1,3 @@
+
+ yes
+
\ No newline at end of file
diff --git a/components/bpel/src/test/resources/loan_approval/soap-loanresp2.xml b/components/bpel/src/test/resources/loan_approval/soap-loanresp2.xml
new file mode 100644
index 000000000..c85f1cd22
--- /dev/null
+++ b/components/bpel/src/test/resources/loan_approval/soap-loanresp2.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+ ns0:unableToHandleRequest
+
+
+ 1
+
+
+
+
\ No newline at end of file
diff --git a/components/bpel/src/test/resources/loan_approval/switchyard.xml b/components/bpel/src/test/resources/loan_approval/switchyard.xml
new file mode 100644
index 000000000..1cc0eef74
--- /dev/null
+++ b/components/bpel/src/test/resources/loan_approval/switchyard.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+ loanServicePT.wsdl
+ localhost:18001
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpel/src/test/resources/log4j.properties b/components/bpel/src/test/resources/log4j.properties
new file mode 100644
index 000000000..104be7601
--- /dev/null
+++ b/components/bpel/src/test/resources/log4j.properties
@@ -0,0 +1,28 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Set root logger level to WARN and its only appender to CONSOLE
+log4j.rootLogger=INFO, CONSOLE
+
+log4j.category.org.apache.ode=INFO
+log4j.category.org.jboss.soa.bpel=INFO
+log4j.category.org.switchyard=INFO
+
+# Console appender
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%p - %C{1}.%M(%L) | %m%n
diff --git a/components/bpel/src/test/resources/risk2AssessmentPT.wsdl b/components/bpel/src/test/resources/risk2AssessmentPT.wsdl
new file mode 100644
index 000000000..eaea87df4
--- /dev/null
+++ b/components/bpel/src/test/resources/risk2AssessmentPT.wsdl
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpel/src/test/resources/risk2_assessment.bpel b/components/bpel/src/test/resources/risk2_assessment.bpel
new file mode 100644
index 000000000..1966d8f1c
--- /dev/null
+++ b/components/bpel/src/test/resources/risk2_assessment.bpel
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ = 1000]]>
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+ low
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpel/src/test/resources/riskAssessmentPT.wsdl b/components/bpel/src/test/resources/riskAssessmentPT.wsdl
new file mode 100644
index 000000000..69d905ab7
--- /dev/null
+++ b/components/bpel/src/test/resources/riskAssessmentPT.wsdl
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpel/src/test/resources/risk_assessment.bpel b/components/bpel/src/test/resources/risk_assessment.bpel
new file mode 100644
index 000000000..7fd5e64ff
--- /dev/null
+++ b/components/bpel/src/test/resources/risk_assessment.bpel
@@ -0,0 +1,111 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ = 1000]]>
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ low
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bpel-say-hello/src/test/resources/xml/soap-request.xml b/components/bpel/src/test/resources/say_hello/soap-request.xml
similarity index 100%
rename from bpel-say-hello/src/test/resources/xml/soap-request.xml
rename to components/bpel/src/test/resources/say_hello/soap-request.xml
diff --git a/bpel-say-hello/src/test/resources/xml/soap-response.xml b/components/bpel/src/test/resources/say_hello/soap-response.xml
similarity index 100%
rename from bpel-say-hello/src/test/resources/xml/soap-response.xml
rename to components/bpel/src/test/resources/say_hello/soap-response.xml
diff --git a/components/bpel/src/test/resources/say_hello/switchyard.xml b/components/bpel/src/test/resources/say_hello/switchyard.xml
new file mode 100644
index 000000000..1e890cb71
--- /dev/null
+++ b/components/bpel/src/test/resources/say_hello/switchyard.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+ SayHelloArtifacts.wsdl
+ :18001
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpel/src/test/resources/tests/wsdl/LoanService.wsdl b/components/bpel/src/test/resources/tests/wsdl/LoanService.wsdl
new file mode 100644
index 000000000..1ad1c0551
--- /dev/null
+++ b/components/bpel/src/test/resources/tests/wsdl/LoanService.wsdl
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpm/pom.xml b/components/bpm/pom.xml
new file mode 100644
index 000000000..93296d2e3
--- /dev/null
+++ b/components/bpm/pom.xml
@@ -0,0 +1,108 @@
+
+
+
+ 4.0.0
+
+ org.switchyard.components
+ switchyard-components-parent
+ 2.1.0-SNAPSHOT
+ ../pom.xml
+
+ switchyard-component-bpm
+ bundle
+ SwitchYard: BPM Component
+ http://switchyard.org
+
+ org.switchyard.component.common.knowledge.deploy.OSGiKnowledgeBundleActivator
+
+ org.switchyard.component.bpm.*
+
+
+ org.switchyard.*;${switchyard.osgi.import.switchyard.version},
+ org.switchyard.config.model;${switchyard.osgi.import.switchyard.version},
+ *
+
+
+ org.jbpm.bpmn2,
+ org.jbpm.flow.core,
+ org.jbpm.persistence.jpa,
+ org.jbpm.services.task.jpa
+
+
+ org.jbpm.*,
+ org.drools.*,
+ org.kie.*
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+
+
+ false
+
+ ${*}
+
+
+
+
+
+
+
+
+ org.switchyard
+ switchyard-api
+
+
+ org.switchyard
+ switchyard-common
+
+
+ org.switchyard
+ switchyard-extensions-java
+
+
+ org.switchyard.components
+ switchyard-component-common-knowledge
+
+
+
+ org.hibernate
+ hibernate-core
+
+
+ org.jbpm
+ jbpm-flow
+
+
+ org.jbpm
+ jbpm-human-task-core
+
+
+ org.jbpm
+ jbpm-human-task-workitems
+
+
+ org.kie
+ kie-api
+
+
+ org.kie
+ kie-internal
+
+
+
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/BPMConstants.java b/components/bpm/src/main/java/org/switchyard/component/bpm/BPMConstants.java
new file mode 100644
index 000000000..d0cb0c1f6
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/BPMConstants.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm;
+
+import javax.xml.namespace.QName;
+
+/**
+ * BPM constants.
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+public final class BPMConstants {
+
+ /** urn:switchyard-component-bpm:bpm:1.0 . */
+ public static final String BPM_NAMESPACE = "urn:switchyard-component-bpm:bpm:1.0";
+
+ /**
+ * sessionId is not used anymore.
+ * @deprecated
+ */
+ @Deprecated
+ public static final String SESSION_ID = "sessionId";
+ /**
+ * {urn:switchyard-component-bpm:bpm:1.0}sessionId is not used anymore.
+ * @deprecated
+ */
+ @Deprecated
+ public static final String SESSION_ID_PROPERTY = new QName(BPM_NAMESPACE, SESSION_ID).toString();
+
+ /** processInstanceId . */
+ public static final String PROCESS_INSTANCE_ID = "processInstanceId";
+ /** {urn:switchyard-component-bpm:bpm:1.0}processInstanceId . */
+ public static final String PROCESSS_INSTANCE_ID_PROPERTY = new QName(BPM_NAMESPACE, PROCESS_INSTANCE_ID).toString();
+
+ /** correlationKey . */
+ public static final String CORRELATION_KEY = "correlationKey";
+ /** {urn:switchyard-component-bpm:bpm:1.0}correlationKey . */
+ public static final String CORRELATION_KEY_PROPERTY = new QName(BPM_NAMESPACE, CORRELATION_KEY).toString();
+
+ private BPMConstants() {}
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/BPMLogger.java b/components/bpm/src/main/java/org/switchyard/component/bpm/BPMLogger.java
new file mode 100644
index 000000000..4385bfbd1
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/BPMLogger.java
@@ -0,0 +1,18 @@
+package org.switchyard.component.bpm;
+
+import org.jboss.logging.Logger;
+import org.jboss.logging.annotations.MessageLogger;
+/**
+ *
+ * This file is using the subset 31600-31999 for logger messages.
+ *
+ *
+ */
+@MessageLogger(projectCode = "SWITCHYARD")
+public interface BPMLogger {
+ /**
+ * A root logger with the category of the package name.
+ */
+ BPMLogger ROOT_LOGGER = Logger.getMessageLogger(BPMLogger.class, BPMLogger.class.getPackage().getName());
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/BPMMessages.java b/components/bpm/src/main/java/org/switchyard/component/bpm/BPMMessages.java
new file mode 100644
index 000000000..aa0c62de9
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/BPMMessages.java
@@ -0,0 +1,62 @@
+package org.switchyard.component.bpm;
+
+import java.io.IOException;
+
+import org.jboss.logging.Messages;
+import org.jboss.logging.annotations.Message;
+import org.jboss.logging.annotations.MessageBundle;
+import org.switchyard.HandlerException;
+import org.switchyard.component.bpm.operation.BPMOperationType;
+
+/**
+ *
+ * This file is using the subset 32000-32399 for logger messages.
+ *
+ *
+ */
+@MessageBundle(projectCode = "SWITCHYARD")
+public interface BPMMessages {
+ /**
+ * The default messages.
+ */
+ BPMMessages MESSAGES = Messages.getBundle(BPMMessages.class);
+
+ /**
+ * bpmClassGetNameIsMissingTheBPMAnnotation method definition.
+ * @param bpmClassName bpmClassName
+ * @return IOException
+ */
+ @Message(id = 32000, value = "%s is missing the @BPM annotation.")
+ IOException bpmClassGetNameIsMissingTheBPMAnnotation(String bpmClassName);
+
+ /**
+ * bpmInterfaceGetNameIsAClassBPMOnlyAllowedOnInterfaces method definition.
+ * @param bpmInterfaceName bpmInterfaceName
+ * @return IOException
+ */
+ @Message(id = 32001, value = "%s is a class. @BPM only allowed on interfaces.")
+ IOException bpmInterfaceGetNameIsAClassBPMOnlyAllowedOnInterfaces(String bpmInterfaceName);
+
+ /**
+ * cannotSignalEventUnknownProcessInstanceIdOrUnknown/unmatchedCorrelationKey method definition.
+ * @return HandlerException
+ */
+ @Message(id = 32002, value = "Cannot signalEvent: unknown processInstanceId or unknown/unmatched correlationKey")
+ HandlerException cannotSignalEventUnknownProcessInstanceIdOrUnknownunmatchedCorrelationKey();
+
+ /**
+ * cannotAbortProcessInstanceUnknownProcessInstanceIdOrUnknown/unmatchedCorrelationKey method definition.
+ * @return HandlerException
+ */
+ @Message(id = 32003, value = "Cannot abortProcessInstance: unknown processInstanceId or unknown/unmatched correlationKey")
+ HandlerException cannotAbortProcessInstance();
+
+ /**
+ * unsupportedOperationType method definition.
+ * @param operationType the operationType
+ * @return HandlerException
+ */
+ @Message(id = 32004, value = "Unsupported operation type: %s")
+ HandlerException unsupportedOperationType(BPMOperationType operationType);
+}
+
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/AbortProcessInstance.java b/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/AbortProcessInstance.java
new file mode 100644
index 000000000..b70e5dca6
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/AbortProcessInstance.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.annotation;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.switchyard.component.common.knowledge.annotation.Fault;
+import org.switchyard.component.common.knowledge.annotation.Output;
+
+/**
+ * AbortProcessInstance.
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+@Target(METHOD)
+@Retention(RUNTIME)
+@Documented
+public @interface AbortProcessInstance {
+
+ /** Outputs. */
+ public Output[] outputs() default {};
+
+ /** Faults. */
+ public Fault[] faults() default {};
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/BPM.java b/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/BPM.java
new file mode 100644
index 000000000..079c35d74
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/BPM.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.annotation;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.switchyard.component.common.knowledge.annotation.Channel;
+import org.switchyard.component.common.knowledge.annotation.Listener;
+import org.switchyard.component.common.knowledge.annotation.Logger;
+import org.switchyard.component.common.knowledge.annotation.Manifest;
+import org.switchyard.component.common.knowledge.annotation.Property;
+
+/**
+ * BPM.
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+@Target(TYPE)
+@Retention(RUNTIME)
+@Documented
+public @interface BPM {
+
+ /** Namespace. */
+ public String namespace() default "";
+
+ /** Name. */
+ public String name() default "";
+
+ /** Undefined interface class. */
+ public Class> value() default UndefinedBPMInterface.class;
+
+ /** Persistent. */
+ public boolean persistent() default false;
+
+ /** Process id. */
+ public String processId() default "";
+
+ /** Channels. */
+ public Channel[] channels() default {};
+
+ /** Listeners. */
+ public Listener[] listeners() default {};
+
+ /** Loggers. */
+ public Logger[] loggers() default {};
+
+ /** Manifest. */
+ public Manifest[] manifest() default {};
+
+ /** Properties. */
+ public Property[] properties() default {};
+
+ /** UserGroupCallback. */
+ public UserGroupCallback[] userGroupCallback() default {};
+
+ /** WorkItemHandlers. */
+ public WorkItemHandler[] workItemHandlers() default {};
+
+ /** Undefined interface class. */
+ public static interface UndefinedBPMInterface {};
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/SignalEvent.java b/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/SignalEvent.java
new file mode 100644
index 000000000..33c7aac55
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/SignalEvent.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.annotation;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.switchyard.component.common.knowledge.annotation.Fault;
+import org.switchyard.component.common.knowledge.annotation.Global;
+import org.switchyard.component.common.knowledge.annotation.Input;
+import org.switchyard.component.common.knowledge.annotation.Output;
+
+/**
+ * SignalEvent.
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+@Target(METHOD)
+@Retention(RUNTIME)
+@Documented
+public @interface SignalEvent {
+
+ /** EventId. */
+ public String eventId() default "";
+
+ /** Globals. */
+ public Global[] globals() default {};
+
+ /** Inputs. */
+ public Input[] inputs() default {};
+
+ /** Outputs. */
+ public Output[] outputs() default {};
+
+ /** Faults. */
+ public Fault[] faults() default {};
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/SignalEventAll.java b/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/SignalEventAll.java
new file mode 100644
index 000000000..ce2611bda
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/SignalEventAll.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.annotation;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.switchyard.component.common.knowledge.annotation.Fault;
+import org.switchyard.component.common.knowledge.annotation.Global;
+import org.switchyard.component.common.knowledge.annotation.Input;
+import org.switchyard.component.common.knowledge.annotation.Output;
+
+/**
+ * SignalEventAll.
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+@Target(METHOD)
+@Retention(RUNTIME)
+@Documented
+public @interface SignalEventAll {
+
+ /** EventId. */
+ public String eventId() default "";
+
+ /** Globals. */
+ public Global[] globals() default {};
+
+ /** Inputs. */
+ public Input[] inputs() default {};
+
+ /** Outputs. */
+ public Output[] outputs() default {};
+
+ /** Faults. */
+ public Fault[] faults() default {};
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/StartProcess.java b/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/StartProcess.java
new file mode 100644
index 000000000..db61ae45c
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/StartProcess.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.annotation;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.switchyard.component.common.knowledge.annotation.Fault;
+import org.switchyard.component.common.knowledge.annotation.Global;
+import org.switchyard.component.common.knowledge.annotation.Input;
+import org.switchyard.component.common.knowledge.annotation.Output;
+
+/**
+ * StartProcess.
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+@Target(METHOD)
+@Retention(RUNTIME)
+@Documented
+public @interface StartProcess {
+
+ /** Globals. */
+ public Global[] globals() default {};
+
+ /** Inputs. */
+ public Input[] inputs() default {};
+
+ /** Outputs. */
+ public Output[] outputs() default {};
+
+ /** Faults. */
+ public Fault[] faults() default {};
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/UserGroupCallback.java b/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/UserGroupCallback.java
new file mode 100644
index 000000000..c35fc810d
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/UserGroupCallback.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.annotation;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.switchyard.component.common.knowledge.annotation.Property;
+
+/**
+ * UserGroupCallback.
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+@Target(TYPE)
+@Retention(RUNTIME)
+@Documented
+public @interface UserGroupCallback {
+
+ // SWITCHYARD-1755: internal api usage still required (public APIs insufficient)
+ /** Impl class. */
+ public Class extends org.kie.internal.task.api.UserGroupCallback> value();
+
+ /** Properties. */
+ public Property[] properties() default {};
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/WorkItemHandler.java b/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/WorkItemHandler.java
new file mode 100644
index 000000000..c0256d663
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/annotation/WorkItemHandler.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.annotation;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * WorkItemHandler.
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+@Target(TYPE)
+@Retention(RUNTIME)
+@Documented
+public @interface WorkItemHandler {
+
+ /** Impl class. */
+ public Class extends org.kie.api.runtime.process.WorkItemHandler> value();
+
+ /** Name. */
+ public String name() default "";
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/BPMComponentImplementationModel.java b/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/BPMComponentImplementationModel.java
new file mode 100644
index 000000000..ba50bcd7d
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/BPMComponentImplementationModel.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.config.model;
+
+import org.switchyard.component.common.knowledge.config.model.KnowledgeComponentImplementationModel;
+
+/**
+ * BPMComponentImplementationModel.
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+public interface BPMComponentImplementationModel extends KnowledgeComponentImplementationModel {
+
+ /**
+ * The "bpm" implementation type.
+ */
+ public static final String BPM = "bpm";
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/BPMNamespace.java b/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/BPMNamespace.java
new file mode 100644
index 000000000..7a566f2fc
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/BPMNamespace.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.config.model;
+
+import org.switchyard.component.common.knowledge.config.model.KnowledgeNamespace;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Namespace;
+
+/**
+ * A BPM config model namespace.
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+public enum BPMNamespace implements KnowledgeNamespace {
+
+ /** The 1.0 namespace. */
+ V_1_0("1.0"),
+ /** The 1.1 namespace. */
+ V_1_1("1.1"),
+ /** The 2.0 namespace. */
+ V_2_0("2.0"),
+ /** The default namespace. */
+ DEFAULT(null);
+
+ private final Util _util;
+
+ /**
+ * Constructs a new BPMNamespace with the specified version.
+ * @param version the specified version, or null to discover the default
+ */
+ BPMNamespace(String version) {
+ _util = new Util(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String section() {
+ return _util.section();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String version() {
+ return _util.version();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean versionMatches(Namespace namespace) {
+ return _util.versionMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String uri() {
+ return _util.uri();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean uriMatches(Namespace namespace) {
+ return _util.uriMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDefault() {
+ return this == DEFAULT || uriMatches(DEFAULT);
+ }
+
+ /**
+ * Gets the BPMNamespace for the specified uri, or null if no matching uris are found.
+ * @param uri the uri
+ * @return the BPMNamespace
+ */
+ public static BPMNamespace fromUri(String uri) {
+ return Util.fromUri(BPMNamespace.class, uri);
+ }
+
+ @SuppressWarnings("serial")
+ private static final class Util extends Namespace.Util {
+ // static final since we only want to do the somewhat expensive work of instantiating this once!
+ private static final Descriptor DESCRIPTOR = new Descriptor(BPMNamespace.class);
+ private Util(String version) {
+ super(DESCRIPTOR, "urn:switchyard-component-bpm:config", version);
+ }
+ }
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/BPMSwitchYardScanner.java b/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/BPMSwitchYardScanner.java
new file mode 100644
index 000000000..afff2d8df
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/BPMSwitchYardScanner.java
@@ -0,0 +1,282 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.config.model;
+
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.List;
+
+import org.jbpm.services.task.wih.AbstractHTWorkItemHandler;
+import org.switchyard.common.lang.Strings;
+import org.switchyard.common.type.classpath.ClasspathScanner;
+import org.switchyard.common.type.classpath.IsAnnotationPresentFilter;
+import org.switchyard.component.bpm.BPMMessages;
+import org.switchyard.component.bpm.annotation.AbortProcessInstance;
+import org.switchyard.component.bpm.annotation.BPM;
+import org.switchyard.component.bpm.annotation.SignalEvent;
+import org.switchyard.component.bpm.annotation.SignalEventAll;
+import org.switchyard.component.bpm.annotation.StartProcess;
+import org.switchyard.component.bpm.annotation.UserGroupCallback;
+import org.switchyard.component.bpm.annotation.WorkItemHandler;
+import org.switchyard.component.bpm.config.model.v1.V1BPMComponentImplementationModel;
+import org.switchyard.component.bpm.config.model.v1.V1BPMOperationModel;
+import org.switchyard.component.bpm.operation.BPMOperationType;
+import org.switchyard.component.common.knowledge.annotation.Fault;
+import org.switchyard.component.common.knowledge.annotation.Global;
+import org.switchyard.component.common.knowledge.annotation.Input;
+import org.switchyard.component.common.knowledge.annotation.Output;
+import org.switchyard.component.common.knowledge.config.model.KnowledgeSwitchYardScanner;
+import org.switchyard.component.common.knowledge.config.model.OperationModel;
+import org.switchyard.component.common.knowledge.config.model.OperationsModel;
+import org.switchyard.component.common.knowledge.config.model.UserGroupCallbackModel;
+import org.switchyard.component.common.knowledge.config.model.WorkItemHandlerModel;
+import org.switchyard.component.common.knowledge.config.model.WorkItemHandlersModel;
+import org.switchyard.component.common.knowledge.config.model.v1.V1OperationsModel;
+import org.switchyard.component.common.knowledge.config.model.v1.V1UserGroupCallbackModel;
+import org.switchyard.component.common.knowledge.config.model.v1.V1WorkItemHandlerModel;
+import org.switchyard.component.common.knowledge.config.model.v1.V1WorkItemHandlersModel;
+import org.switchyard.component.common.knowledge.service.StandardSwitchYardServiceTaskHandler;
+import org.switchyard.component.common.knowledge.service.SwitchYardServiceTaskHandler;
+import org.switchyard.config.model.ScannerInput;
+import org.switchyard.config.model.ScannerOutput;
+import org.switchyard.config.model.composite.ComponentModel;
+import org.switchyard.config.model.composite.ComponentServiceModel;
+import org.switchyard.config.model.composite.CompositeModel;
+import org.switchyard.config.model.composite.InterfaceModel;
+import org.switchyard.config.model.composite.v1.V1ComponentModel;
+import org.switchyard.config.model.composite.v1.V1ComponentServiceModel;
+import org.switchyard.config.model.composite.v1.V1CompositeModel;
+import org.switchyard.config.model.composite.v1.V1InterfaceModel;
+import org.switchyard.config.model.switchyard.SwitchYardModel;
+import org.switchyard.config.model.switchyard.SwitchYardNamespace;
+import org.switchyard.config.model.switchyard.v1.V1SwitchYardModel;
+import org.switchyard.extensions.java.JavaService;
+import org.switchyard.metadata.ServiceOperation;
+
+/**
+ * BPMSwitchYardScanner.
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+public class BPMSwitchYardScanner extends KnowledgeSwitchYardScanner {
+
+ private static final IsAnnotationPresentFilter START_PROCESS_FILTER = new IsAnnotationPresentFilter(StartProcess.class);
+ private static final IsAnnotationPresentFilter SIGNAL_EVENT_FILTER = new IsAnnotationPresentFilter(SignalEvent.class);
+ private static final IsAnnotationPresentFilter SIGNAL_EVENT_ALL_FILTER = new IsAnnotationPresentFilter(SignalEventAll.class);
+ private static final IsAnnotationPresentFilter ABORT_PROCESS_INSTANCE_FILTER = new IsAnnotationPresentFilter(AbortProcessInstance.class);
+
+ private final IsAnnotationPresentFilter _bpmFilter = new IsAnnotationPresentFilter(BPM.class);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ScannerOutput scan(ScannerInput input) throws IOException {
+ SwitchYardNamespace switchyardNamespace = input.getSwitchyardNamespace();
+ SwitchYardModel switchyardModel = new V1SwitchYardModel(switchyardNamespace.uri());
+ CompositeModel compositeModel = new V1CompositeModel();
+ compositeModel.setName(input.getCompositeName());
+ ClasspathScanner bpmScanner = new ClasspathScanner(_bpmFilter);
+ for (URL url : input.getURLs()) {
+ bpmScanner.scan(url);
+ }
+ List> bpmClasses = _bpmFilter.getMatchedTypes();
+ for (Class> bpmClass : bpmClasses) {
+ compositeModel.addComponent(scan(bpmClass, switchyardNamespace));
+ }
+ if (!compositeModel.getModelChildren().isEmpty()) {
+ switchyardModel.setComposite(compositeModel);
+ }
+ return new ScannerOutput().setModel(switchyardModel);
+ }
+
+ /**
+ * Scans a class using the default switchyard namespace.
+ * @param bpmClass the class
+ * @return the component model
+ * @throws IOException oops
+ */
+ public ComponentModel scan(Class> bpmClass) throws IOException {
+ return scan(bpmClass, null);
+ }
+
+ /**
+ * Scans a class using the specified switchyard namespace.
+ * @param bpmClass the class
+ * @param switchyardNamespace the switchyard namespace
+ * @return the component model
+ * @throws IOException oops
+ */
+ public ComponentModel scan(Class> bpmClass, SwitchYardNamespace switchyardNamespace) throws IOException {
+ if (switchyardNamespace == null) {
+ switchyardNamespace = SwitchYardNamespace.DEFAULT;
+ }
+ BPM bpm = bpmClass.getAnnotation(BPM.class);
+ if (bpm == null) {
+ throw BPMMessages.MESSAGES.bpmClassGetNameIsMissingTheBPMAnnotation(bpmClass.getName());
+ }
+ Class> bpmInterface = bpm.value();
+ if (BPM.UndefinedBPMInterface.class.equals(bpmInterface)) {
+ bpmInterface = bpmClass;
+ }
+ if (!bpmInterface.isInterface()) {
+ throw BPMMessages.MESSAGES.bpmInterfaceGetNameIsAClassBPMOnlyAllowedOnInterfaces(bpmInterface.getName());
+ }
+ String bpmName = Strings.trimToNull(bpm.name());
+ if (bpmName == null) {
+ bpmName = bpmInterface.getSimpleName();
+ }
+ ComponentModel componentModel = new V1ComponentModel();
+ componentModel.setName(bpmName);
+ BPMNamespace bpmNamespace = BPMNamespace.fromUri(bpm.namespace());
+ if (bpmNamespace == null) {
+ bpmNamespace = BPMNamespace.DEFAULT;
+ for (BPMNamespace value : BPMNamespace.values()) {
+ if (value.versionMatches(switchyardNamespace)) {
+ bpmNamespace = value;
+ break;
+ }
+ }
+ }
+ BPMComponentImplementationModel componentImplementationModel = new V1BPMComponentImplementationModel(bpmNamespace.uri());
+ boolean persistent = bpm.persistent();
+ if (persistent) {
+ componentImplementationModel.setPersistent(persistent);
+ }
+ String processId = bpm.processId();
+ if (UNDEFINED.equals(processId)) {
+ processId = bpmName;
+ }
+ componentImplementationModel.setProcessId(processId);
+ OperationsModel operationsModel = new V1OperationsModel(bpmNamespace.uri());
+ JavaService javaService = JavaService.fromClass(bpmInterface);
+ for (Method method : bpmClass.getDeclaredMethods()) {
+ BPMOperationType operationType = null;
+ String eventId = null;
+ Global[] globalMappingAnnotations = null;
+ Input[] inputMappingAnnotations = null;
+ Output[] outputMappingAnnotations = null;
+ Fault[] faultMappingAnnotations = null;
+ if (START_PROCESS_FILTER.matches(method)) {
+ operationType = BPMOperationType.START_PROCESS;
+ StartProcess startProcessAnnotation = method.getAnnotation(StartProcess.class);
+ globalMappingAnnotations = startProcessAnnotation.globals();
+ inputMappingAnnotations = startProcessAnnotation.inputs();
+ outputMappingAnnotations = startProcessAnnotation.outputs();
+ faultMappingAnnotations = startProcessAnnotation.faults();
+ } else if (SIGNAL_EVENT_FILTER.matches(method)) {
+ operationType = BPMOperationType.SIGNAL_EVENT;
+ SignalEvent signalEventAnnotation = method.getAnnotation(SignalEvent.class);
+ eventId = Strings.trimToNull(signalEventAnnotation.eventId());
+ globalMappingAnnotations = signalEventAnnotation.globals();
+ inputMappingAnnotations = signalEventAnnotation.inputs();
+ outputMappingAnnotations = signalEventAnnotation.outputs();
+ faultMappingAnnotations = signalEventAnnotation.faults();
+ } else if (SIGNAL_EVENT_ALL_FILTER.matches(method)) {
+ operationType = BPMOperationType.SIGNAL_EVENT_ALL;
+ SignalEventAll signalEventAllAnnotation = method.getAnnotation(SignalEventAll.class);
+ eventId = Strings.trimToNull(signalEventAllAnnotation.eventId());
+ globalMappingAnnotations = signalEventAllAnnotation.globals();
+ inputMappingAnnotations = signalEventAllAnnotation.inputs();
+ outputMappingAnnotations = signalEventAllAnnotation.outputs();
+ faultMappingAnnotations = signalEventAllAnnotation.faults();
+ } else if (ABORT_PROCESS_INSTANCE_FILTER.matches(method)) {
+ operationType = BPMOperationType.ABORT_PROCESS_INSTANCE;
+ AbortProcessInstance abortProcessInstanceAnnotation = method.getAnnotation(AbortProcessInstance.class);
+ globalMappingAnnotations = new Global[]{};
+ inputMappingAnnotations = new Input[]{};
+ outputMappingAnnotations = abortProcessInstanceAnnotation.outputs();
+ faultMappingAnnotations = abortProcessInstanceAnnotation.faults();
+ }
+ if (operationType != null) {
+ ServiceOperation serviceOperation = javaService.getOperation(method.getName());
+ if (serviceOperation != null) {
+ OperationModel operationModel = new V1BPMOperationModel(bpmNamespace.uri());
+ operationModel.setEventId(eventId);
+ operationModel.setName(serviceOperation.getName());
+ operationModel.setType(operationType);
+ operationModel.setGlobals(toGlobalsModel(globalMappingAnnotations, bpmNamespace));
+ operationModel.setInputs(toInputsModel(inputMappingAnnotations, bpmNamespace));
+ operationModel.setOutputs(toOutputsModel(outputMappingAnnotations, bpmNamespace));
+ operationModel.setFaults(toFaultsModel(faultMappingAnnotations, bpmNamespace));
+ operationsModel.addOperation(operationModel);
+ }
+ }
+ }
+ if (!operationsModel.getOperations().isEmpty()) {
+ componentImplementationModel.setOperations(operationsModel);
+ }
+ componentImplementationModel.setChannels(toChannelsModel(bpm.channels(), bpmNamespace, componentModel, switchyardNamespace));
+ componentImplementationModel.setListeners(toListenersModel(bpm.listeners(), bpmNamespace));
+ componentImplementationModel.setLoggers(toLoggersModel(bpm.loggers(), bpmNamespace));
+ componentImplementationModel.setManifest(toManifestModel(bpm.manifest(), bpmNamespace));
+ componentImplementationModel.setProperties(toPropertiesModel(bpm.properties(), bpmNamespace));
+ componentImplementationModel.setUserGroupCallback(toUserGroupCallbackModel(bpm.userGroupCallback(), bpmNamespace));
+ componentImplementationModel.setWorkItemHandlers(toWorkItemHandlersModel(bpm.workItemHandlers(), bpmNamespace));
+ componentModel.setImplementation(componentImplementationModel);
+ ComponentServiceModel componentServiceModel = new V1ComponentServiceModel(switchyardNamespace.uri());
+ InterfaceModel interfaceModel = new V1InterfaceModel(InterfaceModel.JAVA);
+ interfaceModel.setInterface(bpmInterface.getName());
+ componentServiceModel.setInterface(interfaceModel);
+ componentServiceModel.setName(bpmName);
+ componentModel.addService(componentServiceModel);
+ return componentModel;
+ }
+
+ private UserGroupCallbackModel toUserGroupCallbackModel(UserGroupCallback[] userGroupCallbackAnnotations, BPMNamespace bpmNamespace) {
+ if (userGroupCallbackAnnotations == null || userGroupCallbackAnnotations.length == 0) {
+ return null;
+ }
+ UserGroupCallbackModel userGroupCallbackModel = null;
+ for (UserGroupCallback userGroupCallbackAnnotation : userGroupCallbackAnnotations) {
+ userGroupCallbackModel = new V1UserGroupCallbackModel(bpmNamespace.uri());
+ // SWITCHYARD-1755: internal api usage still required (public APIs insufficient)
+ Class extends org.kie.internal.task.api.UserGroupCallback> clazz = userGroupCallbackAnnotation.value();
+ userGroupCallbackModel.setClazz(clazz);
+ userGroupCallbackModel.setProperties(toPropertiesModel(userGroupCallbackAnnotation.properties(), bpmNamespace));
+ break;
+ }
+ return userGroupCallbackModel;
+ }
+
+ private WorkItemHandlersModel toWorkItemHandlersModel(WorkItemHandler[] workItemHandlerAnnotations, BPMNamespace bpmNamespace) {
+ if (workItemHandlerAnnotations == null || workItemHandlerAnnotations.length == 0) {
+ return null;
+ }
+ WorkItemHandlersModel workItemHandlersModel = new V1WorkItemHandlersModel(bpmNamespace.uri());
+ for (WorkItemHandler workItemHandlerAnnotation : workItemHandlerAnnotations) {
+ WorkItemHandlerModel workItemHandlerModel = new V1WorkItemHandlerModel(bpmNamespace.uri());
+ Class extends org.kie.api.runtime.process.WorkItemHandler> clazz = workItemHandlerAnnotation.value();
+ workItemHandlerModel.setClazz(clazz);
+ String name = workItemHandlerAnnotation.name();
+ if (UNDEFINED.equals(name)) {
+ if (StandardSwitchYardServiceTaskHandler.class.isAssignableFrom(clazz)) {
+ name = StandardSwitchYardServiceTaskHandler.SERVICE_TASK;
+ } else if (SwitchYardServiceTaskHandler.class.isAssignableFrom(clazz)) {
+ name = SwitchYardServiceTaskHandler.SWITCHYARD_SERVICE_TASK;
+ } else if (AbstractHTWorkItemHandler.class.isAssignableFrom(clazz)) {
+ name = "Human Task";
+ }
+ }
+ if (UNDEFINED.equals(name)) {
+ name = clazz.getSimpleName();
+ }
+ workItemHandlerModel.setName(name);
+ workItemHandlersModel.addWorkItemHandler(workItemHandlerModel);
+ }
+ return workItemHandlersModel;
+ }
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/v1/V1BPMComponentImplementationModel.java b/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/v1/V1BPMComponentImplementationModel.java
new file mode 100644
index 000000000..45d1e90e6
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/v1/V1BPMComponentImplementationModel.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.config.model.v1;
+
+import org.switchyard.component.bpm.config.model.BPMComponentImplementationModel;
+import org.switchyard.component.common.knowledge.config.model.KnowledgeComponentImplementationModel;
+import org.switchyard.component.common.knowledge.config.model.v1.V1KnowledgeComponentImplementationModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * A "bpm" implementation of a KnowledgeComponentImplementationModel.
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+public class V1BPMComponentImplementationModel extends V1KnowledgeComponentImplementationModel implements BPMComponentImplementationModel {
+
+ /**
+ * Default constructor for application use.
+ * @param namespace namespace
+ */
+ public V1BPMComponentImplementationModel(String namespace) {
+ super(BPM, namespace);
+ }
+
+ /**
+ * Constructor for Marshaller use (ie: V1BPMMarshaller).
+ *
+ * @param config the Configuration
+ * @param desc the Descriptor
+ */
+ public V1BPMComponentImplementationModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isPersistent() {
+ String p = getModelAttribute("persistent");
+ return p != null ? Boolean.parseBoolean(p) : false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public KnowledgeComponentImplementationModel setPersistent(boolean persistent) {
+ setModelAttribute("persistent", String.valueOf(persistent));
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getProcessId() {
+ return getModelAttribute("processId");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public KnowledgeComponentImplementationModel setProcessId(String processId) {
+ setModelAttribute("processId", processId);
+ return this;
+ }
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/v1/V1BPMMarshaller.java b/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/v1/V1BPMMarshaller.java
new file mode 100644
index 000000000..dc2659d9d
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/v1/V1BPMMarshaller.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.config.model.v1;
+
+import static org.switchyard.component.common.knowledge.config.model.OperationModel.OPERATION;
+
+import org.switchyard.component.bpm.config.model.BPMComponentImplementationModel;
+import org.switchyard.component.common.knowledge.config.model.v1.V1KnowledgeMarshaller;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+import org.switchyard.config.model.composite.ComponentImplementationModel;
+
+/**
+ * A CompositeMarshaller which can also create knowledge models.
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+public class V1BPMMarshaller extends V1KnowledgeMarshaller {
+
+ /**
+ * The complete local name ("implementation.bpm").
+ */
+ private static final String IMPLEMENTATION_BPM = ComponentImplementationModel.IMPLEMENTATION + "." + BPMComponentImplementationModel.BPM;
+
+ /**
+ * Required constructor called via reflection.
+ *
+ * @param desc the Descriptor
+ */
+ public V1BPMMarshaller(Descriptor desc) {
+ super(desc);
+ }
+
+ /**
+ * Reads in the Configuration, looking for various knowledge models.
+ * If not found, it falls back to the super class (V1CompositeMarshaller).
+ *
+ * @param config the Configuration
+ * @return the Model
+ */
+ @Override
+ public Model read(Configuration config) {
+ String name = config.getName();
+ Descriptor desc = getDescriptor();
+ if (IMPLEMENTATION_BPM.equals(name)) {
+ return new V1BPMComponentImplementationModel(config, desc);
+ } else if (OPERATION.equals(name)) {
+ return new V1BPMOperationModel(config, desc);
+ }
+ return super.read(config);
+ }
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/v1/V1BPMOperationModel.java b/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/v1/V1BPMOperationModel.java
new file mode 100644
index 000000000..6f3bb74b9
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/v1/V1BPMOperationModel.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.config.model.v1;
+
+import org.switchyard.component.bpm.operation.BPMOperationType;
+import org.switchyard.component.common.knowledge.config.model.v1.V1OperationModel;
+import org.switchyard.component.common.knowledge.operation.KnowledgeOperationType;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * The 1st version BPMOperationModel.
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+public class V1BPMOperationModel extends V1OperationModel {
+
+ /**
+ * Creates a new V1BPMOperationModel.
+ * @param namespace namespace
+ */
+ public V1BPMOperationModel(String namespace) {
+ super(namespace);
+ }
+
+ /**
+ * Creates a new V1BPMOperationModel with the specified configuration and descriptor.
+ * @param config the configuration
+ * @param desc the descriptor
+ */
+ public V1BPMOperationModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public KnowledgeOperationType getType() {
+ String type = getModelAttribute("type");
+ return type != null ? BPMOperationType.valueOf(type) : null;
+ }
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/v2/V2BPMMarshaller.java b/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/v2/V2BPMMarshaller.java
new file mode 100644
index 000000000..60b402f24
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/config/model/v2/V2BPMMarshaller.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2014 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.config.model.v2;
+
+import static org.switchyard.component.common.knowledge.config.model.OperationModel.OPERATION;
+
+import org.switchyard.component.bpm.config.model.BPMComponentImplementationModel;
+import org.switchyard.component.bpm.config.model.v1.V1BPMComponentImplementationModel;
+import org.switchyard.component.bpm.config.model.v1.V1BPMOperationModel;
+import org.switchyard.component.common.knowledge.config.model.v2.V2KnowledgeMarshaller;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+import org.switchyard.config.model.composite.ComponentImplementationModel;
+
+/**
+ * A CompositeMarshaller which can also create knowledge models.
+ *
+ * @author David Ward <dward@jboss.org > © 2014 Red Hat Inc.
+ */
+public class V2BPMMarshaller extends V2KnowledgeMarshaller {
+
+ /**
+ * The complete local name ("implementation.bpm").
+ */
+ private static final String IMPLEMENTATION_BPM = ComponentImplementationModel.IMPLEMENTATION + "." + BPMComponentImplementationModel.BPM;
+
+ /**
+ * Required constructor called via reflection.
+ *
+ * @param desc the Descriptor
+ */
+ public V2BPMMarshaller(Descriptor desc) {
+ super(desc);
+ }
+
+ /**
+ * Reads in the Configuration, looking for various knowledge models.
+ * If not found, it falls back to the super class (V1CompositeMarshaller).
+ *
+ * @param config the Configuration
+ * @return the Model
+ */
+ @Override
+ public Model read(Configuration config) {
+ String name = config.getName();
+ Descriptor desc = getDescriptor();
+ if (IMPLEMENTATION_BPM.equals(name)) {
+ return new V1BPMComponentImplementationModel(config, desc);
+ } else if (OPERATION.equals(name)) {
+ return new V1BPMOperationModel(config, desc);
+ }
+ return super.read(config);
+ }
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/deploy/BPMActivator.java b/components/bpm/src/main/java/org/switchyard/component/bpm/deploy/BPMActivator.java
new file mode 100644
index 000000000..bdf7df40f
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/deploy/BPMActivator.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.deploy;
+
+import javax.xml.namespace.QName;
+
+import org.switchyard.component.bpm.config.model.BPMComponentImplementationModel;
+import org.switchyard.component.bpm.exchange.BPMExchangeHandler;
+import org.switchyard.config.model.composite.ComponentModel;
+import org.switchyard.deploy.BaseActivator;
+import org.switchyard.deploy.ServiceHandler;
+
+/**
+ * Activator for the BPM component.
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+public class BPMActivator extends BaseActivator {
+
+ /**
+ * BPM component activator type name.
+ */
+ public static final String BPM_TYPE = "bpm";
+
+ /**
+ * Constructs a new Activator of type "bpm".
+ */
+ public BPMActivator() {
+ super(BPM_TYPE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ServiceHandler activateService(QName name, ComponentModel config) {
+ return new BPMExchangeHandler((BPMComponentImplementationModel)config.getImplementation(), getServiceDomain(), name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void deactivateService(QName name, ServiceHandler handler) {
+ // no-op
+ }
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/deploy/BPMComponent.java b/components/bpm/src/main/java/org/switchyard/component/bpm/deploy/BPMComponent.java
new file mode 100644
index 000000000..0fc1dd48f
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/deploy/BPMComponent.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.deploy;
+
+import org.switchyard.ServiceDomain;
+import org.switchyard.deploy.Activator;
+import org.switchyard.deploy.BaseComponent;
+
+/**
+ * An implementation of BPM component.
+ *
+ * @author Magesh Kumar B © 2012 Red Hat Inc.
+ */
+public class BPMComponent extends BaseComponent {
+
+ /**
+ * Default constructor.
+ */
+ public BPMComponent() {
+ super(BPMActivator.BPM_TYPE);
+ setName("BPMComponent");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Activator createActivator(ServiceDomain domain) {
+ BPMActivator activator = new BPMActivator();
+ activator.setServiceDomain(domain);
+ return activator;
+ }
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/exchange/BPMExchangeHandler.java b/components/bpm/src/main/java/org/switchyard/component/bpm/exchange/BPMExchangeHandler.java
new file mode 100644
index 000000000..f995ecded
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/exchange/BPMExchangeHandler.java
@@ -0,0 +1,319 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.exchange;
+
+import static org.switchyard.component.common.knowledge.operation.KnowledgeOperations.getInput;
+import static org.switchyard.component.common.knowledge.operation.KnowledgeOperations.getInputMap;
+import static org.switchyard.component.common.knowledge.operation.KnowledgeOperations.setFaults;
+import static org.switchyard.component.common.knowledge.operation.KnowledgeOperations.setGlobals;
+import static org.switchyard.component.common.knowledge.operation.KnowledgeOperations.setOutputs;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl;
+import org.kie.api.runtime.manager.RuntimeEngine;
+import org.kie.api.runtime.process.ProcessInstance;
+import org.kie.internal.KieInternalServices;
+import org.kie.internal.process.CorrelationAwareProcessRuntime;
+import org.kie.internal.process.CorrelationKey;
+import org.kie.internal.process.CorrelationKeyFactory;
+import org.switchyard.Context;
+import org.switchyard.Exchange;
+import org.switchyard.ExchangePattern;
+import org.switchyard.HandlerException;
+import org.switchyard.Message;
+import org.switchyard.ServiceDomain;
+import org.switchyard.common.lang.Strings;
+import org.switchyard.component.bpm.BPMConstants;
+import org.switchyard.component.bpm.BPMMessages;
+import org.switchyard.component.bpm.config.model.BPMComponentImplementationModel;
+import org.switchyard.component.bpm.operation.BPMOperationType;
+import org.switchyard.component.common.knowledge.exchange.KnowledgeExchangeHandler;
+import org.switchyard.component.common.knowledge.operation.KnowledgeOperation;
+import org.switchyard.component.common.knowledge.runtime.KnowledgeRuntimeEngine;
+import org.switchyard.component.common.knowledge.runtime.KnowledgeRuntimeManager;
+import org.switchyard.component.common.knowledge.runtime.KnowledgeRuntimeManagerRegistry;
+import org.switchyard.component.common.knowledge.transaction.TransactionHelper;
+
+/**
+ * A "bpm" implementation of a KnowledgeExchangeHandler.
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+public class BPMExchangeHandler extends KnowledgeExchangeHandler {
+
+ private static final KnowledgeOperation DEFAULT_OPERATION = new KnowledgeOperation(BPMOperationType.START_PROCESS);
+
+ private final boolean _persistent;
+ private final String _processId;
+ private final CorrelationKeyFactory _correlationKeyFactory;
+ private KnowledgeRuntimeManager _runtimeManager;
+
+ /**
+ * Constructs a new BPMExchangeHandler with the specified model, service domain, and service name.
+ * @param model the specified model
+ * @param serviceDomain the specified service domain
+ * @param serviceName the specified service name
+ */
+ public BPMExchangeHandler(BPMComponentImplementationModel model, ServiceDomain serviceDomain, QName serviceName) {
+ super(model, serviceDomain, serviceName);
+ _persistent = model.isPersistent();
+ _processId = model.getProcessId();
+ _correlationKeyFactory = KieInternalServices.Factory.get().newCorrelationKeyFactory();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doStart() {
+ super.doStart();
+ _runtimeManager = newSingletonRuntimeManager();
+ // TODO: SWITCHYARD-1584
+ //_runtimeManager = newPerProcessInstanceRuntimeManager();
+ //_runtimeManager = _persistent ? newPerProcessInstanceRuntimeManager() : newSingletonRuntimeManager();
+ KnowledgeRuntimeManagerRegistry.putRuntimeManager(getServiceDomain().getName(), getServiceName(), _runtimeManager);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doStop() {
+ KnowledgeRuntimeManagerRegistry.removeRuntimeManager(getServiceDomain().getName(), getServiceName());
+ try {
+ _runtimeManager.close();
+ } finally {
+ _runtimeManager = null;
+ super.doStop();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public KnowledgeOperation getDefaultOperation() {
+ return DEFAULT_OPERATION;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void handleOperation(Exchange exchange, KnowledgeOperation operation) throws HandlerException {
+ //Long sessionIdentifier = null;
+ Long processInstanceId = null;
+ Message inputMessage = exchange.getMessage();
+ ExchangePattern exchangePattern = exchange.getContract().getProviderOperation().getExchangePattern();
+ Map expressionVariables = new HashMap();
+ TransactionHelper txh = new TransactionHelper(_persistent);
+ BPMOperationType operationType = (BPMOperationType)operation.getType();
+ switch (operationType) {
+ case START_PROCESS: {
+ try {
+ txh.begin();
+ KnowledgeRuntimeEngine runtime = getRuntimeEngine();
+ //sessionIdentifier = runtime.getSessionIdentifier();
+ setGlobals(inputMessage, operation, runtime, true);
+ Map inputMap = getInputMap(inputMessage, operation, runtime);
+ ProcessInstance processInstance;
+ CorrelationKey correlationKey = getCorrelationKey(exchange, inputMessage);
+ if (correlationKey != null) {
+ processInstance = ((CorrelationAwareProcessRuntime)runtime.getKieSession()).startProcess(_processId, correlationKey, inputMap);
+ } else {
+ processInstance = runtime.getKieSession().startProcess(_processId, inputMap);
+ }
+ processInstanceId = Long.valueOf(processInstance.getId());
+ if (ExchangePattern.IN_OUT.equals(exchangePattern)) {
+ expressionVariables.putAll(getGlobalVariables(runtime));
+ expressionVariables.putAll(getProcessInstanceVariables(processInstance));
+ }
+ if (!_persistent) {
+ _runtimeManager.disposeRuntimeEngine(runtime);
+ }
+ txh.commit();
+ } catch (RuntimeException re) {
+ txh.rollback();
+ throw re;
+ }
+ break;
+ }
+ case SIGNAL_EVENT:
+ case SIGNAL_EVENT_ALL: {
+ try {
+ txh.begin();
+ KnowledgeRuntimeEngine runtime;
+ if (BPMOperationType.SIGNAL_EVENT.equals(operationType)) {
+ runtime = getRuntimeEngine(exchange, inputMessage);
+ } else { //BPMOperationType.SIGNAL_EVENT_ALL
+ runtime = getRuntimeEngine();
+ }
+ //sessionIdentifier = runtime.getSessionIdentifier();
+ setGlobals(inputMessage, operation, runtime, true);
+ Object eventObject = getInput(inputMessage, operation, runtime);
+ String eventId = operation.getEventId();
+ if (BPMOperationType.SIGNAL_EVENT.equals(operationType)) {
+ processInstanceId = getProcessInstanceId(exchange, inputMessage, runtime);
+ if (processInstanceId == null) {
+ throw BPMMessages.MESSAGES.cannotSignalEventUnknownProcessInstanceIdOrUnknownunmatchedCorrelationKey();
+ }
+ if (ExchangePattern.IN_OUT.equals(exchangePattern)) {
+ ProcessInstance processInstance = runtime.getKieSession().getProcessInstance(processInstanceId);
+ processInstance.signalEvent(eventId, eventObject);
+ expressionVariables.putAll(getGlobalVariables(runtime));
+ expressionVariables.putAll(getProcessInstanceVariables(processInstance));
+ } else {
+ runtime.getKieSession().signalEvent(eventId, eventObject, processInstanceId);
+ }
+ } else { //BPMOperationType.SIGNAL_EVENT_ALL
+ runtime.getKieSession().signalEvent(eventId, eventObject);
+ if (ExchangePattern.IN_OUT.equals(exchangePattern)) {
+ expressionVariables.putAll(getGlobalVariables(runtime));
+ }
+ }
+ if (!_persistent) {
+ _runtimeManager.disposeRuntimeEngine(runtime);
+ }
+ txh.commit();
+ } catch (RuntimeException re) {
+ txh.rollback();
+ throw re;
+ }
+ break;
+ }
+ case ABORT_PROCESS_INSTANCE: {
+ try {
+ txh.begin();
+ KnowledgeRuntimeEngine runtime = getRuntimeEngine(exchange, inputMessage);
+ //sessionIdentifier = runtime.getSessionIdentifier();
+ processInstanceId = getProcessInstanceId(exchange, inputMessage, runtime);
+ if (processInstanceId == null) {
+ throw BPMMessages.MESSAGES.cannotAbortProcessInstance();
+ }
+ if (ExchangePattern.IN_OUT.equals(exchangePattern)) {
+ expressionVariables.putAll(getGlobalVariables(runtime));
+ ProcessInstance processInstance = runtime.getKieSession().getProcessInstance(processInstanceId);
+ expressionVariables.putAll(getProcessInstanceVariables(processInstance));
+ }
+ runtime.getKieSession().abortProcessInstance(processInstanceId);
+ if (!_persistent) {
+ _runtimeManager.disposeRuntimeEngine(runtime);
+ }
+ txh.commit();
+ } catch (RuntimeException re) {
+ txh.rollback();
+ throw re;
+ }
+ break;
+ }
+ default: {
+ throw BPMMessages.MESSAGES.unsupportedOperationType(operationType);
+ }
+ }
+ if (ExchangePattern.IN_OUT.equals(exchangePattern)) {
+ Message outputMessage = exchange.createMessage();
+ Context outputContext = exchange.getContext(outputMessage);
+ /*
+ if (sessionIdentifier != null) {
+ outputContext.setProperty(BPMConstants.SESSION_ID_PROPERTY, sessionIdentifier);
+ }
+ */
+ if (processInstanceId != null) {
+ outputContext.setProperty(BPMConstants.PROCESSS_INSTANCE_ID_PROPERTY, processInstanceId);
+ }
+ setFaults(outputMessage, operation, expressionVariables);
+ if (outputMessage.getContent() != null) {
+ exchange.sendFault(outputMessage);
+ } else {
+ setOutputs(outputMessage, operation, expressionVariables);
+ exchange.send(outputMessage);
+ }
+ }
+ }
+
+ private KnowledgeRuntimeEngine getRuntimeEngine() {
+ return (KnowledgeRuntimeEngine)_runtimeManager.getRuntimeEngine();
+ }
+
+ private KnowledgeRuntimeEngine getRuntimeEngine(Exchange exchange, Message message) throws HandlerException {
+ RuntimeEngine runtimeEngine = null;
+ Long processInstanceId = getProcessInstanceId(exchange, message);
+ if (processInstanceId != null) {
+ runtimeEngine = _runtimeManager.getRuntimeEngine(processInstanceId);
+ }
+ if (runtimeEngine == null) {
+ CorrelationKey correlationKey = getCorrelationKey(exchange, message);
+ if (correlationKey != null) {
+ runtimeEngine = _runtimeManager.getRuntimeEngine(correlationKey);
+ }
+ }
+ if (runtimeEngine == null) {
+ throw new HandlerException("runtimeEngine == null");
+ }
+ return (KnowledgeRuntimeEngine)runtimeEngine;
+ }
+
+ private CorrelationKey getCorrelationKey(Exchange exchange, Message message) {
+ String ckp = getString(exchange, message, BPMConstants.CORRELATION_KEY_PROPERTY);
+ if (ckp != null) {
+ List properties = Strings.splitTrimToNull(ckp, " \t\n\r\f");
+ if (properties.size() > 0) {
+ return _correlationKeyFactory.newCorrelationKey(properties);
+ }
+ }
+ return null;
+ }
+
+ private Long getProcessInstanceId(Exchange exchange, Message message) {
+ return getLong(exchange, message, BPMConstants.PROCESSS_INSTANCE_ID_PROPERTY);
+ }
+
+ private Long getProcessInstanceId(Exchange exchange, Message message, KnowledgeRuntimeEngine session) {
+ Long processInstanceId = getProcessInstanceId(exchange, message);
+ if (processInstanceId == null) {
+ CorrelationKey correlationKey = getCorrelationKey(exchange, message);
+ if (correlationKey != null) {
+ processInstanceId = getProcessInstanceId(correlationKey, session);
+ }
+ }
+ return processInstanceId;
+ }
+
+ private Long getProcessInstanceId(CorrelationKey correlationKey, KnowledgeRuntimeEngine session) {
+ if (correlationKey != null) {
+ ProcessInstance processInstance = ((CorrelationAwareProcessRuntime)session.getKieSession()).getProcessInstance(correlationKey);
+ if (processInstance != null) {
+ return Long.valueOf(processInstance.getId());
+ }
+ }
+ return null;
+ }
+
+ private Map getProcessInstanceVariables(ProcessInstance processInstance) {
+ Map processInstanceVariables = new HashMap();
+ if (processInstance instanceof WorkflowProcessInstanceImpl) {
+ Map var = ((WorkflowProcessInstanceImpl)processInstance).getVariables();
+ if (var != null) {
+ processInstanceVariables.putAll(var);
+ }
+ }
+ return processInstanceVariables;
+ }
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/operation/BPMOperationType.java b/components/bpm/src/main/java/org/switchyard/component/bpm/operation/BPMOperationType.java
new file mode 100644
index 000000000..1b77f2092
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/operation/BPMOperationType.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.operation;
+
+import org.switchyard.component.common.knowledge.operation.KnowledgeOperationType;
+
+/**
+ * Represents bpm operation types.
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+public enum BPMOperationType implements KnowledgeOperationType {
+
+ /** The start process type. */
+ START_PROCESS,
+ /** The signal event type. */
+ SIGNAL_EVENT,
+ /** The signal event all type. */
+ SIGNAL_EVENT_ALL,
+ /** The abort process instance type. */
+ ABORT_PROCESS_INSTANCE;
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/runtime/BPMTaskService.java b/components/bpm/src/main/java/org/switchyard/component/bpm/runtime/BPMTaskService.java
new file mode 100644
index 000000000..1f1e9330b
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/runtime/BPMTaskService.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.runtime;
+
+import org.jbpm.services.task.lifecycle.listeners.TaskLifeCycleEventListener;
+import org.kie.internal.task.api.EventService;
+import org.kie.internal.task.api.InternalTaskService;
+
+/**
+ * BPMTaskService is DEPRECATED .
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ * @deprecated See {@link BPMTaskServiceRegistry} deprecation.
+ */
+@Deprecated
+public interface BPMTaskService extends InternalTaskService, EventService {}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/runtime/BPMTaskServiceRegistry.java b/components/bpm/src/main/java/org/switchyard/component/bpm/runtime/BPMTaskServiceRegistry.java
new file mode 100644
index 000000000..2c2fbb28f
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/runtime/BPMTaskServiceRegistry.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.runtime;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import javax.xml.namespace.QName;
+
+import org.kie.api.runtime.manager.RuntimeEngine;
+import org.kie.api.task.TaskService;
+import org.switchyard.component.common.knowledge.runtime.KnowledgeRuntimeManager;
+import org.switchyard.component.common.knowledge.runtime.KnowledgeRuntimeManagerRegistry;
+
+/**
+ * BPMTaskServiceRegistry is DEPRECATED .
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ * @deprecated Use {@link KnowledgeRuntimeManagerRegistry} instead.
+ */
+@Deprecated
+public final class BPMTaskServiceRegistry {
+
+ /**
+ * Gets a task service.
+ * @param serviceDomainName the service domain name
+ * @param serviceName the service name
+ * @return the task service
+ */
+ public static final synchronized BPMTaskService getTaskService(QName serviceDomainName, QName serviceName) {
+ KnowledgeRuntimeManager runtimeManager = KnowledgeRuntimeManagerRegistry.getRuntimeManager(serviceDomainName, serviceName);
+ if (runtimeManager != null) {
+ RuntimeEngine runtimeEngine = runtimeManager.getRuntimeEngine();
+ if (runtimeEngine != null) {
+ final TaskService taskService = runtimeEngine.getTaskService();
+ if (taskService != null) {
+ InvocationHandler ih = new InvocationHandler() {
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ return method.invoke(taskService, args);
+ }
+ };
+ return (BPMTaskService)Proxy.newProxyInstance(BPMTaskService.class.getClassLoader(), new Class[]{BPMTaskService.class}, ih);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Puts a task service.
+ * @param serviceDomainName the service domain name
+ * @param serviceName the service name
+ * @param taskService the task service
+ */
+ public static final synchronized void putTaskService(QName serviceDomainName, QName serviceName, BPMTaskService taskService) {
+ // deprecated
+ }
+
+ /**
+ * Removes a task service.
+ * @param serviceDomainName the service domain name
+ * @param serviceName the service name
+ */
+ public static final synchronized void removeTaskService(QName serviceDomainName, QName serviceName) {
+ // deprecated
+ }
+
+ private BPMTaskServiceRegistry() {}
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/runtime/BPMUserGroupCallback.java b/components/bpm/src/main/java/org/switchyard/component/bpm/runtime/BPMUserGroupCallback.java
new file mode 100644
index 000000000..9257fe501
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/runtime/BPMUserGroupCallback.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.runtime;
+
+import java.util.Properties;
+
+import org.switchyard.component.common.knowledge.task.PropertiesUserGroupCallback;
+
+/**
+ * BPMUserGroupCallback is DEPRECATED .
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ * @deprecated Use {@link PropertiesUserGroupCallback} instead.
+ */
+@Deprecated
+public class BPMUserGroupCallback extends PropertiesUserGroupCallback {
+
+ /**
+ * Constructs a new BPMUserGroupCallback.
+ */
+ public BPMUserGroupCallback() {
+ super();
+ }
+
+ /**
+ * Constructs a new BPMUserGroupCallback.
+ * @param location the location
+ */
+ public BPMUserGroupCallback(String location) {
+ super(location);
+ }
+
+ /**
+ * Constructs a new BPMUserGroupCallback.
+ * @param userGroups the userGroups
+ */
+ public BPMUserGroupCallback(Properties userGroups) {
+ super(userGroups);
+ }
+
+}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/transaction/AS7JtaPlatform.java b/components/bpm/src/main/java/org/switchyard/component/bpm/transaction/AS7JtaPlatform.java
new file mode 100644
index 000000000..30ac0d496
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/transaction/AS7JtaPlatform.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.transaction;
+
+import org.switchyard.component.common.knowledge.transaction.KnowledgeJtaPlatform;
+
+/**
+ * AS7JtaPlatform is DEPRECATED .
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ * @deprecated Use {@link KnowledgeJtaPlatform} instead.
+ */
+@Deprecated
+@SuppressWarnings("serial")
+public class AS7JtaPlatform extends KnowledgeJtaPlatform {}
diff --git a/components/bpm/src/main/java/org/switchyard/component/bpm/transaction/AS7TransactionManagerLookup.java b/components/bpm/src/main/java/org/switchyard/component/bpm/transaction/AS7TransactionManagerLookup.java
new file mode 100644
index 000000000..bf92f6f4d
--- /dev/null
+++ b/components/bpm/src/main/java/org/switchyard/component/bpm/transaction/AS7TransactionManagerLookup.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.transaction;
+
+import org.switchyard.component.common.knowledge.transaction.KnowledgeTransactionManagerLookup;
+
+/**
+ * AS7TransactionManagerLookup is DEPRECATED .
+ *
+ * See: jBPM5 on AS7: Lightning !
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ * @deprecated Use {@link AS7JtaPlatform} instead
+ */
+@Deprecated
+public class AS7TransactionManagerLookup extends KnowledgeTransactionManagerLookup {}
diff --git a/components/bpm/src/main/resources/META-INF/SwitchYardWorkDefinitions.wid b/components/bpm/src/main/resources/META-INF/SwitchYardWorkDefinitions.wid
new file mode 100644
index 000000000..8fa7d6e03
--- /dev/null
+++ b/components/bpm/src/main/resources/META-INF/SwitchYardWorkDefinitions.wid
@@ -0,0 +1,28 @@
+// Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+//
+// 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.
+import org.drools.process.core.datatype.impl.type.StringDataType;
+[
+ [
+ "name" : "SwitchYard Service Task",
+ "parameters" : [
+ "ServiceName" : new StringDataType(),
+ "OperationName" : new StringDataType(),
+ "ParameterName" : new StringDataType(),
+ "ResultName" : new StringDataType(),
+ "FaultName" : new StringDataType(),
+ "FaultEventId" : new StringDataType(),
+ "FaultAction" : new StringDataType()
+ ],
+ "displayName" : "SwitchYard Service Task",
+ "icon" : "org/switchyard/component/bpm/SwitchYard-16x16.gif"
+ ]
+]
diff --git a/components/bpm/src/main/resources/META-INF/drools.rulebase.conf b/components/bpm/src/main/resources/META-INF/drools.rulebase.conf
new file mode 100644
index 000000000..300c267a7
--- /dev/null
+++ b/components/bpm/src/main/resources/META-INF/drools.rulebase.conf
@@ -0,0 +1,2 @@
+# Include both Drools' and jBPM's original work definitions, and add SwitchYard's.
+drools.workDefinitions = WorkDefinitions.conf BPMNWorkDefinitions.conf SwitchYardWorkDefinitions.wid
diff --git a/components/bpm/src/main/resources/META-INF/services/org.switchyard.deploy.Component b/components/bpm/src/main/resources/META-INF/services/org.switchyard.deploy.Component
new file mode 100644
index 000000000..30d05c4be
--- /dev/null
+++ b/components/bpm/src/main/resources/META-INF/services/org.switchyard.deploy.Component
@@ -0,0 +1,12 @@
+# Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+org.switchyard.component.bpm.deploy.BPMComponent
diff --git a/components/bpm/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/components/bpm/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644
index 000000000..8e8d45676
--- /dev/null
+++ b/components/bpm/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/bpm/src/main/resources/org/switchyard/component/bpm/SwitchYard-16x16.gif b/components/bpm/src/main/resources/org/switchyard/component/bpm/SwitchYard-16x16.gif
new file mode 100644
index 000000000..ad5951b8a
Binary files /dev/null and b/components/bpm/src/main/resources/org/switchyard/component/bpm/SwitchYard-16x16.gif differ
diff --git a/components/bpm/src/main/resources/org/switchyard/component/bpm/config/model/v1/bpm_1_0.xsd b/components/bpm/src/main/resources/org/switchyard/component/bpm/config/model/v1/bpm_1_0.xsd
new file mode 100644
index 000000000..0222f1c7f
--- /dev/null
+++ b/components/bpm/src/main/resources/org/switchyard/component/bpm/config/model/v1/bpm_1_0.xsd
@@ -0,0 +1,314 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpm/src/main/resources/org/switchyard/component/bpm/config/model/v1/bpm_1_1.xsd b/components/bpm/src/main/resources/org/switchyard/component/bpm/config/model/v1/bpm_1_1.xsd
new file mode 100644
index 000000000..e8dbfd68f
--- /dev/null
+++ b/components/bpm/src/main/resources/org/switchyard/component/bpm/config/model/v1/bpm_1_1.xsd
@@ -0,0 +1,330 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpm/src/main/resources/org/switchyard/component/bpm/config/model/v2/bpm_2_0.xsd b/components/bpm/src/main/resources/org/switchyard/component/bpm/config/model/v2/bpm_2_0.xsd
new file mode 100644
index 000000000..b008c2df2
--- /dev/null
+++ b/components/bpm/src/main/resources/org/switchyard/component/bpm/config/model/v2/bpm_2_0.xsd
@@ -0,0 +1,392 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpm/src/main/resources/org/switchyard/config/model/descriptor.properties b/components/bpm/src/main/resources/org/switchyard/config/model/descriptor.properties
new file mode 100644
index 000000000..2d3337ecd
--- /dev/null
+++ b/components/bpm/src/main/resources/org/switchyard/config/model/descriptor.properties
@@ -0,0 +1,32 @@
+# Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+
+bpm_1_0.section=urn:switchyard-component-bpm:config
+bpm_1_0.version=1.0
+bpm_1_0.namespace=urn:switchyard-component-bpm:config:1.0
+bpm_1_0.schema=bpm_1_0.xsd
+bpm_1_0.location=/org/switchyard/component/bpm/config/model/v1/
+bpm_1_0.marshaller=org.switchyard.component.bpm.config.model.v1.V1BPMMarshaller
+
+bpm_1_1.section=urn:switchyard-component-bpm:config
+bpm_1_1.version=1.1
+bpm_1_1.namespace=urn:switchyard-component-bpm:config:1.1
+bpm_1_1.schema=bpm_1_1.xsd
+bpm_1_1.location=/org/switchyard/component/bpm/config/model/v1/
+bpm_1_1.marshaller=org.switchyard.component.bpm.config.model.v1.V1BPMMarshaller
+
+bpm_2_0.section=urn:switchyard-component-bpm:config
+bpm_2_0.version=2.0
+bpm_2_0.namespace=urn:switchyard-component-bpm:config:2.0
+bpm_2_0.schema=bpm_2_0.xsd
+bpm_2_0.location=/org/switchyard/component/bpm/config/model/v2/
+bpm_2_0.marshaller=org.switchyard.component.bpm.config.model.v2.V2BPMMarshaller
diff --git a/components/bpm/src/test/java/org/switchyard/component/bpm/config/model/BPMModelTests.java b/components/bpm/src/test/java/org/switchyard/component/bpm/config/model/BPMModelTests.java
new file mode 100644
index 000000000..b2c3c7079
--- /dev/null
+++ b/components/bpm/src/test/java/org/switchyard/component/bpm/config/model/BPMModelTests.java
@@ -0,0 +1,379 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.config.model;
+
+import java.io.File;
+import java.io.StringReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.drools.core.event.DebugProcessEventListener;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.kie.api.builder.ReleaseId;
+import org.kie.api.runtime.Channel;
+import org.kie.api.runtime.process.WorkItem;
+import org.kie.api.runtime.process.WorkItemHandler;
+import org.kie.api.runtime.process.WorkItemManager;
+import org.kie.internal.task.api.UserGroupCallback;
+import org.switchyard.common.io.pull.StringPuller;
+import org.switchyard.common.io.resource.ResourceDetail;
+import org.switchyard.common.io.resource.ResourceType;
+import org.switchyard.common.type.Classes;
+import org.switchyard.component.bpm.operation.BPMOperationType;
+import org.switchyard.component.common.knowledge.LoggerType;
+import org.switchyard.component.common.knowledge.config.manifest.ContainerManifest;
+import org.switchyard.component.common.knowledge.config.model.ChannelModel;
+import org.switchyard.component.common.knowledge.config.model.ContainerModel;
+import org.switchyard.component.common.knowledge.config.model.ExtraJaxbClassModel;
+import org.switchyard.component.common.knowledge.config.model.ExtraJaxbClassesModel;
+import org.switchyard.component.common.knowledge.config.model.FaultModel;
+import org.switchyard.component.common.knowledge.config.model.GlobalModel;
+import org.switchyard.component.common.knowledge.config.model.InputModel;
+import org.switchyard.component.common.knowledge.config.model.ListenerModel;
+import org.switchyard.component.common.knowledge.config.model.LoggerModel;
+import org.switchyard.component.common.knowledge.config.model.ManifestModel;
+import org.switchyard.component.common.knowledge.config.model.OperationModel;
+import org.switchyard.component.common.knowledge.config.model.OutputModel;
+import org.switchyard.component.common.knowledge.config.model.RemoteJmsModel;
+import org.switchyard.component.common.knowledge.config.model.RemoteModel;
+import org.switchyard.component.common.knowledge.config.model.RemoteRestModel;
+import org.switchyard.component.common.knowledge.config.model.UserGroupCallbackModel;
+import org.switchyard.component.common.knowledge.config.model.WorkItemHandlerModel;
+import org.switchyard.config.model.ModelPuller;
+import org.switchyard.config.model.Scanner;
+import org.switchyard.config.model.ScannerInput;
+import org.switchyard.config.model.ScannerOutput;
+import org.switchyard.config.model.composite.ComponentImplementationModel;
+import org.switchyard.config.model.composite.ComponentModel;
+import org.switchyard.config.model.composite.CompositeModel;
+import org.switchyard.config.model.property.PropertyModel;
+import org.switchyard.config.model.resource.ResourceModel;
+import org.switchyard.config.model.resource.ResourcesModel;
+import org.switchyard.config.model.switchyard.SwitchYardModel;
+
+/**
+ * Tests BPM models.
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+public class BPMModelTests {
+
+ private static final String CONTAINER_XML = "/org/switchyard/component/bpm/config/model/BPMModelTests-Container.xml";
+ private static final String RESOURCES_XML = "/org/switchyard/component/bpm/config/model/BPMModelTests-Resources.xml";
+ private static final String REMOTEJMS_XML = "/org/switchyard/component/bpm/config/model/BPMModelTests-RemoteJms.xml";
+ private static final String REMOTEREST_XML = "/org/switchyard/component/bpm/config/model/BPMModelTests-RemoteRest.xml";
+
+ private ModelPuller _puller;
+
+ @Before
+ public void before() throws Exception {
+ _puller = new ModelPuller();
+ }
+
+ @After
+ public void after() throws Exception {
+ _puller = null;
+ }
+
+ @Test
+ public void testReadContainer() throws Exception {
+ doTestRead(CONTAINER_XML);
+ }
+
+ @Test
+ public void testReadResources() throws Exception {
+ doTestRead(RESOURCES_XML);
+ }
+
+ @Test
+ public void testReadRemoteJms() throws Exception {
+ doTestRead(REMOTEJMS_XML);
+ }
+
+ @Test
+ public void testReadRemoteRest() throws Exception {
+ doTestRead(REMOTEREST_XML);
+ }
+
+ private void doTestRead(String xml) throws Exception {
+ ClassLoader loader = getClass().getClassLoader();
+ doTestModel(_puller.pull(xml, loader), xml, loader);
+ }
+
+ private void doTestModel(SwitchYardModel switchyard, String xml, ClassLoader loader) throws Exception {
+ CompositeModel composite = switchyard.getComposite();
+ ComponentModel component = null;
+ for (ComponentModel c : composite.getComponents()) {
+ if (DoStuffProcess.class.getSimpleName().equals(c.getName())) {
+ component = c;
+ break;
+ }
+ }
+ ComponentImplementationModel implementation = component.getImplementation();
+ Assert.assertTrue(implementation instanceof BPMComponentImplementationModel);
+ BPMComponentImplementationModel bpm = (BPMComponentImplementationModel)implementation;
+ Assert.assertEquals("bpm", bpm.getType());
+ Assert.assertTrue(bpm.isPersistent());
+ Assert.assertEquals("theProcessId", bpm.getProcessId());
+ OperationModel operation = bpm.getOperations().getOperations().get(0);
+ Assert.assertEquals("theEventId", operation.getEventId());
+ Assert.assertEquals("process", operation.getName());
+ Assert.assertEquals(BPMOperationType.SIGNAL_EVENT, operation.getType());
+ GlobalModel globalModel = operation.getGlobals().getGlobals().get(0);
+ Assert.assertEquals("context['foobar']", globalModel.getFrom());
+ Assert.assertEquals("globalVar", globalModel.getTo());
+ InputModel inputModel = operation.getInputs().getInputs().get(0);
+ Assert.assertEquals("message.content.nested", inputModel.getFrom());
+ Assert.assertEquals("inputVar", inputModel.getTo());
+ OutputModel outputModel = operation.getOutputs().getOutputs().get(0);
+ Assert.assertEquals("outputVar", outputModel.getFrom());
+ Assert.assertEquals("message.content", outputModel.getTo());
+ FaultModel faultModel = operation.getFaults().getFaults().get(0);
+ Assert.assertEquals("faultVar", faultModel.getFrom());
+ Assert.assertEquals("message.content", faultModel.getTo());
+ ChannelModel channel = bpm.getChannels().getChannels().get(0);
+ Assert.assertEquals(TestChannel.class, channel.getClazz(loader));
+ Assert.assertEquals("theName", channel.getName());
+ Assert.assertEquals("theOperation", channel.getOperation());
+ Assert.assertEquals("theReference", channel.getReference());
+ ListenerModel listener = bpm.getListeners().getListeners().get(0);
+ Assert.assertEquals(DebugProcessEventListener.class, listener.getClazz(loader));
+ LoggerModel logger = bpm.getLoggers().getLoggers().get(0);
+ Assert.assertEquals(Integer.valueOf(2000), logger.getInterval());
+ Assert.assertEquals("theLog", logger.getLog());
+ Assert.assertEquals(LoggerType.CONSOLE, logger.getType());
+ ManifestModel manifest = bpm.getManifest();
+ ContainerModel container = manifest.getContainer();
+ ResourcesModel resources = manifest.getResources();
+ RemoteModel remote = manifest.getRemote();
+ if (CONTAINER_XML.equals(xml)) {
+ Assert.assertNull(resources);
+ Assert.assertNull(remote);
+ ReleaseId rid = ContainerManifest.toReleaseId(container.getReleaseId());
+ Assert.assertEquals("theGroupId", rid.getGroupId());
+ Assert.assertEquals("theArtifactId", rid.getArtifactId());
+ Assert.assertEquals("theVersion", rid.getVersion());
+ Assert.assertEquals("theBase", container.getBaseName());
+ Assert.assertEquals("theSession", container.getSessionName());
+ Assert.assertTrue(container.isScan());
+ Assert.assertEquals(Long.valueOf(1000), container.getScanInterval());
+ } else if (RESOURCES_XML.equals(xml)) {
+ Assert.assertNull(container);
+ Assert.assertNull(remote);
+ ResourceModel bpmn2Resource = resources.getResources().get(0);
+ Assert.assertEquals("foobar.bpmn", bpmn2Resource.getLocation());
+ Assert.assertEquals(ResourceType.valueOf("BPMN2"), bpmn2Resource.getType());
+ ResourceModel dtableResource = resources.getResources().get(1);
+ Assert.assertEquals("foobar.xls", dtableResource.getLocation());
+ Assert.assertEquals(ResourceType.valueOf("DTABLE"), dtableResource.getType());
+ ResourceDetail dtableDetail = dtableResource.getDetail();
+ Assert.assertEquals("XLS", dtableDetail.getInputType());
+ Assert.assertEquals("MySheet", dtableDetail.getWorksheetName());
+ /* SWITCHYARD-1662
+ Assert.assertEquals(true, dtableDetail.isUsingExternalTypes());
+ */
+ } else if (REMOTEJMS_XML.equals(xml) || REMOTEREST_XML.equals(xml)) {
+ Assert.assertNull(container);
+ Assert.assertNull(resources);
+ Assert.assertEquals("groupId:artifactId:0.0.1", remote.getDeploymentId());
+ Assert.assertEquals("kermit", remote.getUserName());
+ Assert.assertEquals("the-frog-1", remote.getPassword());
+ Assert.assertEquals(5, remote.getTimeout().intValue());
+ ExtraJaxbClassesModel extraJaxbClasses = remote.getExtraJaxbClasses();
+ Assert.assertNotNull(extraJaxbClasses);
+ List extraJaxbClassList = extraJaxbClasses.getExtraJaxbClasses();
+ Assert.assertEquals(2, extraJaxbClassList.size());
+ Assert.assertEquals(Object.class, extraJaxbClassList.get(0).getClazz(loader));
+ Assert.assertEquals(String.class, extraJaxbClassList.get(1).getClazz(loader));
+ if (REMOTEJMS_XML.equals(xml)) {
+ RemoteJmsModel remoteJms = (RemoteJmsModel)remote;
+ Assert.assertEquals("remotehost", remoteJms.getHostName());
+ Assert.assertEquals(4447, remoteJms.getRemotingPort().intValue());
+ Assert.assertEquals(5455, remoteJms.getMessagingPort().intValue());
+ Assert.assertEquals(true, remoteJms.isUseSsl());
+ Assert.assertEquals("ksp", remoteJms.getKeystorePassword());
+ Assert.assertEquals("/ksl", remoteJms.getKeystoreLocation());
+ Assert.assertEquals("tsp", remoteJms.getTruststorePassword());
+ Assert.assertEquals("/tsl", remoteJms.getTruststoreLocation());
+ } else if (REMOTEREST_XML.equals(xml)) {
+ RemoteRestModel remoteRest = (RemoteRestModel)remote;
+ Assert.assertEquals("http://localhost:8080/kie-wb/", remoteRest.getUrl());
+ }
+ } else {
+ Assert.fail("couldn't find container, resources, remoteJms, or remoteRest");
+ }
+ PropertyModel bpm_property = bpm.getProperties().getProperties().get(0);
+ Assert.assertEquals("foo", bpm_property.getName());
+ Assert.assertEquals("bar", bpm_property.getValue());
+ UserGroupCallbackModel userGroupCallback = bpm.getUserGroupCallback();
+ Assert.assertEquals(TestUserGroupCallback.class, userGroupCallback.getClazz(loader));
+ PropertyModel ugc_property = userGroupCallback.getProperties().getProperties().get(0);
+ Assert.assertEquals("rab", ugc_property.getName());
+ Assert.assertEquals("oof", ugc_property.getValue());
+ WorkItemHandlerModel workItemHandler = bpm.getWorkItemHandlers().getWorkItemHandlers().get(0);
+ Assert.assertEquals(TestWorkItemHandler.class, workItemHandler.getClazz(loader));
+ Assert.assertEquals("MyWIH", workItemHandler.getName());
+ }
+
+ @Test
+ public void testWriteContainer() throws Exception {
+ doTestWrite(CONTAINER_XML);
+ }
+
+ @Test
+ public void testWriteResources() throws Exception {
+ doTestWrite(RESOURCES_XML);
+ }
+
+ @Test
+ public void testWriteRemoteJms() throws Exception {
+ doTestWrite(REMOTEJMS_XML);
+ }
+
+ @Test
+ public void testWriteRemoteRest() throws Exception {
+ doTestWrite(REMOTEREST_XML);
+ }
+
+ private void doTestWrite(String xml) throws Exception {
+ String old_xml = new StringPuller().pull(xml, getClass());
+ SwitchYardModel switchyard = _puller.pull(new StringReader(old_xml));
+ String new_xml = switchyard.toString();
+ XMLUnit.setIgnoreWhitespace(true);
+ Diff diff = XMLUnit.compareXML(old_xml, new_xml);
+ Assert.assertTrue(diff.toString(), diff.identical());
+ }
+
+ @Test
+ public void testValidateContainer() throws Exception {
+ doTestValidate(CONTAINER_XML);
+ }
+
+ @Test
+ public void testValidateResources() throws Exception {
+ doTestValidate(RESOURCES_XML);
+ }
+
+ @Test
+ public void testValidateRemoteJms() throws Exception {
+ doTestValidate(REMOTEJMS_XML);
+ }
+
+ @Test
+ public void testValidateRemoteRest() throws Exception {
+ doTestValidate(REMOTEREST_XML);
+ }
+
+ private void doTestValidate(String xml) throws Exception {
+ SwitchYardModel switchyard = _puller.pull(xml, getClass());
+ switchyard.assertModelValid();
+ }
+
+ @Test
+ @Ignore
+ public void testScanContainer() throws Exception {
+ doTestScan(CONTAINER_XML);
+ }
+
+ @Test
+ public void testScanResources() throws Exception {
+ doTestScan(RESOURCES_XML);
+ }
+
+ @Test
+ @Ignore
+ public void testScanRemoteJms() throws Exception {
+ doTestScan(REMOTEJMS_XML);
+ }
+
+ @Test
+ @Ignore
+ public void testScanRemoteRest() throws Exception {
+ doTestScan(REMOTEREST_XML);
+ }
+
+ private void doTestScan(String xml) throws Exception {
+ ClassLoader loader = getClass().getClassLoader();
+ Scanner scanner = new BPMSwitchYardScanner();
+ ScannerInput input = new ScannerInput().setCompositeName(getClass().getSimpleName());
+ List urls = new ArrayList();
+ String resPath = getClass().getName().replaceAll("\\.", "/") + ".class";
+ String urlPath = Classes.getResource(resPath).getPath();
+ File file = new File(urlPath.substring(0, urlPath.length() - resPath.length()));
+ urls.add(file.toURI().toURL());
+ input.setURLs(urls);
+ ScannerOutput output = scanner.scan(input);
+ SwitchYardModel model = output.getModel();
+ CompositeModel composite = model.getComposite();
+ Assert.assertEquals(getClass().getSimpleName(), composite.getName());
+ doTestModel(model, xml, loader);
+ }
+
+ @Test
+ public void testScanEmpty() throws Exception {
+ Scanner scanner = new BPMSwitchYardScanner();
+ ScannerInput input = new ScannerInput();
+ ScannerOutput output = scanner.scan(input);
+ Assert.assertNull("Composite element should not be created if no components were found.", output.getModel().getComposite());
+ }
+
+ public static final class TestChannel implements Channel {
+ @Override
+ public void send(Object object) {
+ System.out.println(object);
+ }
+ }
+
+ public static final class TestUserGroupCallback implements UserGroupCallback {
+ @Override
+ public boolean existsUser(String userId) {
+ System.out.println(userId);
+ return false;
+ }
+ @Override
+ public boolean existsGroup(String groupId) {
+ System.out.println(groupId);
+ return false;
+ }
+ @Override
+ public List getGroupsForUser(String userId, List groupIds, List allExistingGroupIds) {
+ System.out.println(userId);
+ System.out.println(groupIds);
+ System.out.println(allExistingGroupIds);
+ return Collections.emptyList();
+ }
+ }
+
+ public static final class TestWorkItemHandler implements WorkItemHandler {
+ @Override
+ public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
+ System.out.println(workItem);
+ System.out.println(manager);
+ }
+ @Override
+ public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
+ System.out.println(workItem);
+ System.out.println(manager);
+ }
+ }
+
+}
diff --git a/components/bpm/src/test/java/org/switchyard/component/bpm/config/model/DoStuff.java b/components/bpm/src/test/java/org/switchyard/component/bpm/config/model/DoStuff.java
new file mode 100644
index 000000000..6a53acf59
--- /dev/null
+++ b/components/bpm/src/test/java/org/switchyard/component/bpm/config/model/DoStuff.java
@@ -0,0 +1,7 @@
+package org.switchyard.component.bpm.config.model;
+
+public interface DoStuff {
+
+ public void process(Object stuff);
+
+}
diff --git a/components/bpm/src/test/java/org/switchyard/component/bpm/config/model/DoStuffProcess.java b/components/bpm/src/test/java/org/switchyard/component/bpm/config/model/DoStuffProcess.java
new file mode 100644
index 000000000..430bd2f9a
--- /dev/null
+++ b/components/bpm/src/test/java/org/switchyard/component/bpm/config/model/DoStuffProcess.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.config.model;
+
+import org.drools.core.event.DebugProcessEventListener;
+import org.switchyard.component.bpm.annotation.BPM;
+import org.switchyard.component.bpm.annotation.SignalEvent;
+import org.switchyard.component.bpm.annotation.UserGroupCallback;
+import org.switchyard.component.bpm.annotation.WorkItemHandler;
+import org.switchyard.component.common.knowledge.LoggerType;
+import org.switchyard.component.common.knowledge.annotation.Channel;
+import org.switchyard.component.common.knowledge.annotation.Fault;
+import org.switchyard.component.common.knowledge.annotation.Global;
+import org.switchyard.component.common.knowledge.annotation.Input;
+import org.switchyard.component.common.knowledge.annotation.Listener;
+import org.switchyard.component.common.knowledge.annotation.Logger;
+import org.switchyard.component.common.knowledge.annotation.Manifest;
+import org.switchyard.component.common.knowledge.annotation.Output;
+import org.switchyard.component.common.knowledge.annotation.Property;
+import org.switchyard.component.common.knowledge.annotation.Resource;
+import org.switchyard.component.common.knowledge.annotation.ResourceDetail;
+
+/**
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+@BPM(
+ persistent=true,
+ processId="theProcessId",
+ channels=@Channel(name="theName", operation="theOperation", reference="theReference", value=BPMModelTests.TestChannel.class),
+ listeners=@Listener(DebugProcessEventListener.class),
+ loggers=@Logger(interval=2000, log="theLog", type=LoggerType.CONSOLE),
+ manifest=@Manifest(
+ //container=@Container(baseName="theBase", scan=true, scanInterval=1000, releaseId="theGroupId:theArtifactId:theVersion", sessionName="theSession"),
+ resources={
+ @Resource(location="foobar.bpmn", type="BPMN2"),
+ @Resource(location="foobar.xls", type="DTABLE",
+ detail=@ResourceDetail(inputType="XLS", worksheetName="MySheet")) // SWITCHYARD-1662, usingExternalTypes=true))
+ }),
+ properties=@Property(name="foo", value="bar"),
+ userGroupCallback=@UserGroupCallback(
+ value=BPMModelTests.TestUserGroupCallback.class,
+ properties=@Property(name="rab", value="oof")),
+ workItemHandlers=@WorkItemHandler(name="MyWIH", value=BPMModelTests.TestWorkItemHandler.class)
+)
+public interface DoStuffProcess extends DoStuff {
+
+ @Override
+ @SignalEvent(
+ eventId="theEventId",
+ globals=@Global(from="context['foobar']", to="globalVar"),
+ inputs=@Input(from="message.content.nested", to="inputVar"),
+ outputs=@Output(from="outputVar", to="message.content"),
+ faults=@Fault(from="faultVar", to="message.content")
+ )
+ public void process(Object stuff);
+
+}
diff --git a/components/bpm/src/test/java/org/switchyard/component/bpm/service/BPMServiceTests.java b/components/bpm/src/test/java/org/switchyard/component/bpm/service/BPMServiceTests.java
new file mode 100644
index 000000000..7b8084651
--- /dev/null
+++ b/components/bpm/src/test/java/org/switchyard/component/bpm/service/BPMServiceTests.java
@@ -0,0 +1,466 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.service;
+
+import static org.switchyard.component.bpm.BPMConstants.CORRELATION_KEY_PROPERTY;
+import static org.switchyard.component.bpm.BPMConstants.PROCESSS_INSTANCE_ID_PROPERTY;
+import static org.switchyard.component.common.knowledge.service.SwitchYardServiceTaskHandler.SWITCHYARD_SERVICE_TASK;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.activation.DataSource;
+import javax.xml.namespace.QName;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.kie.api.KieBase;
+import org.kie.api.io.ResourceType;
+import org.kie.api.runtime.KieSession;
+import org.kie.api.runtime.process.WorkflowProcessInstance;
+import org.kie.internal.builder.KnowledgeBuilder;
+import org.kie.internal.builder.KnowledgeBuilderFactory;
+import org.kie.internal.io.ResourceFactory;
+import org.switchyard.BaseHandler;
+import org.switchyard.Exchange;
+import org.switchyard.HandlerException;
+import org.switchyard.Message;
+import org.switchyard.Service;
+import org.switchyard.ServiceDomain;
+import org.switchyard.component.bpm.annotation.BPM;
+import org.switchyard.component.bpm.annotation.SignalEvent;
+import org.switchyard.component.bpm.annotation.SignalEventAll;
+import org.switchyard.component.bpm.annotation.StartProcess;
+import org.switchyard.component.bpm.annotation.WorkItemHandler;
+import org.switchyard.component.bpm.config.model.BPMComponentImplementationModel;
+import org.switchyard.component.bpm.config.model.BPMSwitchYardScanner;
+import org.switchyard.component.bpm.exchange.BPMExchangeHandler;
+import org.switchyard.component.common.knowledge.annotation.Input;
+import org.switchyard.component.common.knowledge.annotation.Manifest;
+import org.switchyard.component.common.knowledge.annotation.Output;
+import org.switchyard.component.common.knowledge.annotation.Resource;
+import org.switchyard.component.common.knowledge.service.SwitchYardServiceInvoker;
+import org.switchyard.component.common.knowledge.service.SwitchYardServiceTaskHandler;
+import org.switchyard.extensions.java.JavaService;
+import org.switchyard.metadata.InOnlyService;
+import org.switchyard.metadata.InOutService;
+import org.switchyard.test.InvocationFaultException;
+import org.switchyard.test.Invoker;
+import org.switchyard.test.SwitchYardRunner;
+import org.switchyard.test.TestDataSource;
+
+/**
+ * Tests the BPM implementation.
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+@RunWith(SwitchYardRunner.class)
+public class BPMServiceTests {
+
+ private static final String ACCESS_ATTACHMENT_BPMN = "org/switchyard/component/bpm/service/BPMServiceTests-AccessAttachment.bpmn";
+ private static final String CALL_SERVICE_BPMN = "org/switchyard/component/bpm/service/BPMServiceTests-CallService.bpmn";
+ private static final String CONTROL_PROCESS_BPMN = "org/switchyard/component/bpm/service/BPMServiceTests-ControlProcess.bpmn";
+ private static final String FAULT_RESULT_PROCESS_BPMN = "org/switchyard/component/bpm/service/BPMServiceTests-FaultResultProcess.bpmn";
+ private static final String FAULT_EVENT_PROCESS_BPMN = "org/switchyard/component/bpm/service/BPMServiceTests-FaultEventProcess.bpmn";
+ private static final String FAULT_BOUNDARY_PROCESS_BPMN = "org/switchyard/component/bpm/service/BPMServiceTests-FaultBoundaryProcess.bpmn";
+ private static final String REUSE_HANDLER_BPMN = "org/switchyard/component/bpm/service/BPMServiceTests-ReuseHandler.bpmn";
+ private static final String RULES_FIRED_BPMN = "org/switchyard/component/bpm/service/BPMServiceTests-RulesFired.bpmn";
+ private static final String RULES_FIRED_DRL = "org/switchyard/component/bpm/service/BPMServiceTests-RulesFired.drl";
+ private static final String SIGNAL_PROCESS_BPMN = "org/switchyard/component/bpm/service/BPMServiceTests-SignalProcess.bpmn";
+
+ private ServiceDomain serviceDomain;
+
+ @Test
+ public void testCallService() throws Exception {
+ final Holder holder = new Holder();
+ serviceDomain.registerService(new QName("CallService"), new InOnlyService(), new BaseHandler(){
+ public void handleMessage(Exchange exchange) throws HandlerException {
+ holder.setValue("message handled");
+ }
+ });
+ serviceDomain.registerServiceReference(new QName("CallService"), new InOnlyService());
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+ kbuilder.add(ResourceFactory.newClassPathResource(CALL_SERVICE_BPMN), ResourceType.BPMN2);
+ KieBase kbase = kbuilder.newKnowledgeBase();
+ KieSession ksession = kbase.newKieSession();
+ SwitchYardServiceTaskHandler ssth = new SwitchYardServiceTaskHandler();
+ ssth.setProcessRuntime(ksession);
+ ssth.setInvoker(new SwitchYardServiceInvoker(serviceDomain));
+ ksession.getWorkItemManager().registerWorkItemHandler(SWITCHYARD_SERVICE_TASK, ssth);
+ ksession.startProcess("CallService");
+ ksession.halt();
+ ksession.dispose();
+ Assert.assertEquals("message handled", holder.getValue());
+ }
+
+ @BPM(processId="AccessAttachment", manifest=@Manifest(resources=@Resource(location=ACCESS_ATTACHMENT_BPMN, type="BPMN2")))
+ public interface AccessAttachment {
+ @StartProcess(inputs={
+ @Input(from="message.attachmentMap['someAttach']", to="attachment"),
+ @Input(from="message.content", to="holder")
+ })
+ public Object process(Object content);
+ }
+
+ @Test
+ public void testAccessAttachment() throws Exception {
+ final Holder holder = new Holder();
+ BPMComponentImplementationModel bci_model = (BPMComponentImplementationModel)new BPMSwitchYardScanner().scan(AccessAttachment.class).getImplementation();
+ QName serviceName = new QName("AccessAttachment");
+ BPMExchangeHandler handler = new BPMExchangeHandler(bci_model, serviceDomain, serviceName);
+ Service service = serviceDomain.registerService(serviceName, JavaService.fromClass(AccessAttachment.class), handler);
+ serviceDomain.registerServiceReference(service.getName(), service.getInterface(), service.getProviderHandler());
+ handler.start();
+ DataSource attachment = new TestDataSource("someAttach", "text/plain", "someAttachData");
+ new Invoker(serviceDomain, serviceName).operation("process").attachment(attachment.getName(), attachment).sendInOnly(holder);
+ handler.stop();
+ Assert.assertEquals("someAttachData", holder.getValue());
+ }
+
+ @BPM(processId="ControlProcess", manifest=@Manifest(resources=@Resource(location=CONTROL_PROCESS_BPMN, type="BPMN2")))
+ public interface ControlProcess {
+ @StartProcess
+ public Object process(Object content);
+ @SignalEvent(eventId="test")
+ public void signal(Object content);
+ }
+
+ @Test
+ public void testControlProcess() throws Exception {
+ final Holder holder = new Holder();
+ Service callService = serviceDomain.registerService(new QName("CallService"), new InOnlyService(), new BaseHandler(){
+ public void handleMessage(Exchange exchange) throws HandlerException {
+ holder.setValue("message handled");
+ }
+ });
+ serviceDomain.registerServiceReference(callService.getName(), callService.getInterface(), callService.getProviderHandler());
+ BPMComponentImplementationModel bci_model = (BPMComponentImplementationModel)new BPMSwitchYardScanner().scan(ControlProcess.class).getImplementation();
+ // setting the component name to null so that the service reference doesn't use the component-qualified name
+ bci_model.getComponent().setName(null);
+ QName serviceName = new QName("ControlProcess");
+ BPMExchangeHandler handler = new BPMExchangeHandler(bci_model, serviceDomain, serviceName);
+ Service controlService = serviceDomain.registerService(serviceName, JavaService.fromClass(ControlProcess.class), handler);
+ serviceDomain.registerServiceReference(controlService.getName(), controlService.getInterface(), controlService.getProviderHandler());
+ handler.start();
+ Invoker processInvoker = new Invoker(serviceDomain, serviceName);
+ Message processResponse = processInvoker.operation("process").sendInOut(null);
+ Long processInstanceId = (Long)processResponse.getContext().getPropertyValue(PROCESSS_INSTANCE_ID_PROPERTY);
+ Invoker signalInvoker = new Invoker(serviceDomain, serviceName);
+ signalInvoker.operation("signal").property(PROCESSS_INSTANCE_ID_PROPERTY, processInstanceId).sendInOut(null);
+ handler.stop();
+ Assert.assertEquals("message handled", holder.getValue());
+ }
+
+ @Test
+ public void testCorrelateProcessSuccess() throws Exception {
+ runCorrelateProcess(false);
+ }
+
+ @Test
+ public void testCorrelateProcessFailure() throws Exception {
+ runCorrelateProcess(true);
+ }
+
+ private void runCorrelateProcess(final boolean bomb) throws Exception {
+ final AtomicInteger counter = new AtomicInteger();
+ final Holder holder = new Holder();
+ Service callService = serviceDomain.registerService(new QName("CallService"), new InOnlyService(), new BaseHandler(){
+ public void handleMessage(Exchange exchange) throws HandlerException {
+ int count = counter.incrementAndGet();
+ holder.setValue(String.valueOf(count));
+ }
+ });
+ serviceDomain.registerServiceReference(callService.getName(), callService.getInterface(), callService.getProviderHandler());
+ BPMComponentImplementationModel bci_model = (BPMComponentImplementationModel)new BPMSwitchYardScanner().scan(ControlProcess.class).getImplementation();
+ // setting the component name to null so that the service reference doesn't use the component-qualified name
+ bci_model.getComponent().setName(null);
+ QName serviceName = new QName("ControlProcess");
+ BPMExchangeHandler handler = new BPMExchangeHandler(bci_model, serviceDomain, serviceName);
+ Service controlService = serviceDomain.registerService(serviceName, JavaService.fromClass(ControlProcess.class), handler);
+ serviceDomain.registerServiceReference(controlService.getName(), controlService.getInterface(), controlService.getProviderHandler());
+ handler.start();
+ new Invoker(serviceDomain, serviceName).operation("process").property(CORRELATION_KEY_PROPERTY, "A").sendInOnly(null);
+ new Invoker(serviceDomain, serviceName).operation("process").property(CORRELATION_KEY_PROPERTY, "B").sendInOnly(null);
+ new Invoker(serviceDomain, serviceName).operation("signal").property(CORRELATION_KEY_PROPERTY, "A").sendInOnly(null);
+ InvocationFaultException fault = null;
+ try {
+ new Invoker(serviceDomain, serviceName).operation("signal").property(CORRELATION_KEY_PROPERTY, bomb ? "A" : "B").sendInOut(null);
+ } catch (InvocationFaultException ife) {
+ fault = ife;
+ }
+ handler.stop();
+ if (bomb) {
+ Assert.assertNotNull(fault);
+ Assert.assertEquals("1", holder.getValue());
+ } else {
+ Assert.assertNull(fault);
+ Assert.assertEquals("2", holder.getValue());
+ }
+ }
+
+ @BPM(processId="ControlProcess", manifest=@Manifest(resources=@Resource(location=CONTROL_PROCESS_BPMN, type="BPMN2")))
+ public interface SignalAllProcesses {
+ @StartProcess
+ public Object process(Object content);
+ @SignalEventAll(eventId="test")
+ public void signal(Object content);
+ }
+
+ @Test
+ public void testSignalAllProcesses() throws Exception {
+ final AtomicInteger counter = new AtomicInteger();
+ final Holder holder = new Holder();
+ Service callService = serviceDomain.registerService(new QName("CallService"), new InOnlyService(), new BaseHandler(){
+ public void handleMessage(Exchange exchange) throws HandlerException {
+ int count = counter.incrementAndGet();
+ holder.setValue(String.valueOf(count));
+ }
+ });
+ serviceDomain.registerServiceReference(callService.getName(), callService.getInterface(), callService.getProviderHandler());
+ BPMComponentImplementationModel bci_model = (BPMComponentImplementationModel)new BPMSwitchYardScanner().scan(SignalAllProcesses.class).getImplementation();
+ // setting the component name to null so that the service reference doesn't use the component-qualified name
+ bci_model.getComponent().setName(null);
+ QName serviceName = new QName("ControlProcess");
+ BPMExchangeHandler handler = new BPMExchangeHandler(bci_model, serviceDomain, serviceName);
+ Service controlService = serviceDomain.registerService(serviceName, JavaService.fromClass(SignalAllProcesses.class), handler);
+ serviceDomain.registerServiceReference(controlService.getName(), controlService.getInterface(), controlService.getProviderHandler());
+ handler.start();
+ new Invoker(serviceDomain, serviceName).operation("process").sendInOnly(null);
+ new Invoker(serviceDomain, serviceName).operation("process").sendInOnly(null);
+ new Invoker(serviceDomain, serviceName).operation("signal").sendInOnly(null);
+ handler.stop();
+ Assert.assertEquals("2", holder.getValue());
+ }
+
+ @Test
+ public void testFaultResultProcessSuccess() throws Exception {
+ runFaultResultProcess(false);
+ }
+
+ @Test
+ public void testFaultResultProcessFailure() throws Exception {
+ runFaultResultProcess(true);
+ }
+
+ private void runFaultResultProcess(final boolean bomb) throws Exception {
+ serviceDomain.registerService(new QName("TestService"), new InOnlyService(), new BaseHandler(){
+ public void handleMessage(Exchange exchange) throws HandlerException {
+ if (bomb) {
+ throw new HandlerException("BOOM!");
+ }
+ }
+ });
+ serviceDomain.registerServiceReference(new QName("TestService"), new InOutService());
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+ kbuilder.add(ResourceFactory.newClassPathResource(FAULT_RESULT_PROCESS_BPMN), ResourceType.BPMN2);
+ KieBase kbase = kbuilder.newKnowledgeBase();
+ KieSession ksession = kbase.newKieSession();
+ SwitchYardServiceTaskHandler ssth = new SwitchYardServiceTaskHandler();
+ ssth.setProcessRuntime(ksession);
+ ssth.setInvoker(new SwitchYardServiceInvoker(serviceDomain));
+ ksession.getWorkItemManager().registerWorkItemHandler(SWITCHYARD_SERVICE_TASK, ssth);
+ WorkflowProcessInstance wpi = (WorkflowProcessInstance)ksession.startProcess("FaultResultProcess");
+ HandlerException he = (HandlerException)wpi.getVariable("faultResult");
+ if (bomb) {
+ Assert.assertNotNull(he);
+ Assert.assertEquals("BOOM!", he.getMessage());
+ } else {
+ Assert.assertNull(he);
+ }
+ ksession.halt();
+ ksession.dispose();
+ }
+
+ @Test
+ public void testFaultEventProcessSuccess() throws Exception {
+ runFaultEventProcess(false);
+ }
+
+ @Test
+ public void testFaultEventProcessFailure() throws Exception {
+ runFaultEventProcess(true);
+ }
+
+ private void runFaultEventProcess(final boolean bomb) throws Exception {
+ serviceDomain.registerService(new QName("TestService"), new InOnlyService(), new BaseHandler(){
+ public void handleMessage(Exchange exchange) throws HandlerException {
+ if (bomb) {
+ throw new HandlerException("BOOM!");
+ }
+ }
+ });
+ serviceDomain.registerServiceReference(new QName("TestService"), new InOutService());
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+ kbuilder.add(ResourceFactory.newClassPathResource(FAULT_EVENT_PROCESS_BPMN), ResourceType.BPMN2);
+ KieBase kbase = kbuilder.newKnowledgeBase();
+ KieSession ksession = kbase.newKieSession();
+ SwitchYardServiceTaskHandler ssth = new SwitchYardServiceTaskHandler();
+ ssth.setProcessRuntime(ksession);
+ ssth.setInvoker(new SwitchYardServiceInvoker(serviceDomain));
+ ksession.getWorkItemManager().registerWorkItemHandler(SWITCHYARD_SERVICE_TASK, ssth);
+ WorkflowProcessInstance wpi = (WorkflowProcessInstance)ksession.startProcess("FaultEventProcess");
+ HandlerException he = (HandlerException)wpi.getVariable("faultEvent");
+ if (bomb) {
+ Assert.assertNotNull(he);
+ Assert.assertEquals("BOOM!", he.getMessage());
+ } else {
+ Assert.assertNull(he);
+ }
+ ksession.halt();
+ ksession.dispose();
+ }
+
+ @Test
+ public void testFaultBoundaryProcessSuccess() throws Exception {
+ runFaultBoundaryProcess(false);
+ }
+
+ @Test
+ public void testFaultBoundaryProcessFailure() throws Exception {
+ runFaultBoundaryProcess(true);
+ }
+
+ private void runFaultBoundaryProcess(final boolean bomb) throws Exception {
+ serviceDomain.registerService(new QName("TestService"), new InOnlyService(), new BaseHandler(){
+ public void handleMessage(Exchange exchange) throws HandlerException {
+ if (bomb) {
+ throw new HandlerException("BOOM!");
+ }
+ }
+ });
+ serviceDomain.registerServiceReference(new QName("TestService"), new InOutService());
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+ kbuilder.add(ResourceFactory.newClassPathResource(FAULT_BOUNDARY_PROCESS_BPMN), ResourceType.BPMN2);
+ KieBase kbase = kbuilder.newKnowledgeBase();
+ KieSession ksession = kbase.newKieSession();
+ SwitchYardServiceTaskHandler ssth = new SwitchYardServiceTaskHandler();
+ ssth.setProcessRuntime(ksession);
+ ssth.setInvoker(new SwitchYardServiceInvoker(serviceDomain));
+ ksession.getWorkItemManager().registerWorkItemHandler(SWITCHYARD_SERVICE_TASK, ssth);
+ WorkflowProcessInstance wpi = (WorkflowProcessInstance)ksession.startProcess("FaultBoundaryProcess");
+ String output = (String)wpi.getVariable("TestOutput");
+ Assert.assertEquals(bomb ? "Failure" : "Success", output);
+ ksession.halt();
+ ksession.dispose();
+ }
+
+ @BPM(processId="ReuseHandler", manifest=@Manifest(resources=@Resource(location=REUSE_HANDLER_BPMN, type="BPMN2")),
+ workItemHandlers=@WorkItemHandler(name="ReuseHandler", value=ReuseHandler.class))
+ public interface ReuseHandlerProcess {
+ @StartProcess(inputs=@Input(from="message.content", to="holder"))
+ public void process(Object content);
+ }
+
+ @Test
+ public void testReuseHandler() throws Exception {
+ BPMComponentImplementationModel bci_model = (BPMComponentImplementationModel)new BPMSwitchYardScanner().scan(ReuseHandlerProcess.class).getImplementation();
+ QName serviceName = new QName("ReuseHandler");
+ BPMExchangeHandler handler = new BPMExchangeHandler(bci_model, serviceDomain, serviceName);
+ Service service = serviceDomain.registerService(serviceName, new InOnlyService("process"), handler);
+ serviceDomain.registerServiceReference(service.getName(), service.getInterface(), service.getProviderHandler());
+ handler.start();
+ new Invoker(serviceDomain, serviceName).operation("process").sendInOnly(null);
+ handler.stop();
+ Assert.assertEquals("handler executed", ReuseHandler._holder.getValue());
+ ReuseHandler._holder.setValue(null);
+ }
+
+ @BPM(processId="RulesFired", manifest=@Manifest(resources={
+ @Resource(location=RULES_FIRED_BPMN, type="BPMN2"),
+ @Resource(location=RULES_FIRED_DRL, type="DRL")}))
+ public interface RulesFiredProcess {
+ @StartProcess(inputs=@Input(from="message.content", to="holder"))
+ public void process(Object content);
+ }
+
+ @Test
+ public void testRulesFired() throws Exception {
+ final Holder holder = new Holder();
+ BPMComponentImplementationModel bci_model = (BPMComponentImplementationModel)new BPMSwitchYardScanner().scan(RulesFiredProcess.class).getImplementation();
+ QName serviceName = new QName("RulesFired");
+ BPMExchangeHandler handler = new BPMExchangeHandler(bci_model, serviceDomain, serviceName);
+ Service service = serviceDomain.registerService(serviceName, new InOnlyService("process"), handler);
+ serviceDomain.registerServiceReference(service.getName(), service.getInterface(), service.getProviderHandler());
+ handler.start();
+ new Invoker(serviceDomain, serviceName).operation("process").sendInOnly(holder);
+ handler.stop();
+ Assert.assertEquals("rules fired", holder.getValue());
+ }
+
+ @BPM(processId="SignalProcess", manifest=@Manifest(resources=@Resource(location=SIGNAL_PROCESS_BPMN, type="BPMN2")))
+ public interface SignalProcess {
+ @StartProcess(
+ inputs={@Input(from="message.content", to="Parameter")},
+ outputs={@Output(from="Result", to="message.content")}
+ )
+ public Object process(Object content);
+ @SignalEvent(
+ eventId="TestSignal1",
+ inputs={@Input(from="message.content", to="Parameter")},
+ outputs={@Output(from="Result", to="message.content")}
+ )
+ public Object signal(Object content);
+ }
+
+ @Test
+ public void testSignalProcess() throws Exception {
+ final Map testAssertionMap = new HashMap();
+ Service serviceOne = serviceDomain.registerService(new QName("ServiceOne"), new InOutService(), new BaseHandler(){
+ public void handleMessage(Exchange exchange) throws HandlerException {
+ Holder h = exchange.getMessage().getContent(Holder.class);
+ testAssertionMap.put("ServiceOne", h.getValue());
+ }
+ });
+ Service serviceTwo = serviceDomain.registerService(new QName("ServiceTwo"), new InOutService(), new BaseHandler(){
+ public void handleMessage(Exchange exchange) throws HandlerException {
+ Holder h = exchange.getMessage().getContent(Holder.class);
+ testAssertionMap.put("ServiceTwo", h.getValue());
+ }
+ });
+ serviceDomain.registerServiceReference(serviceOne.getName(), serviceOne.getInterface(), serviceOne.getProviderHandler());
+ serviceDomain.registerServiceReference(serviceTwo.getName(), serviceTwo.getInterface(), serviceTwo.getProviderHandler());
+ BPMComponentImplementationModel bci_model = (BPMComponentImplementationModel)new BPMSwitchYardScanner().scan(SignalProcess.class).getImplementation();
+ // setting the component name to null so that the service reference doesn't use the component-qualified name
+ bci_model.getComponent().setName(null);
+ QName serviceName = new QName("SignalProcess");
+ BPMExchangeHandler handler = new BPMExchangeHandler(bci_model, serviceDomain, serviceName);
+ Service signalService = serviceDomain.registerService(serviceName, JavaService.fromClass(SignalProcess.class), handler);
+ serviceDomain.registerServiceReference(signalService.getName(), signalService.getInterface(), signalService.getProviderHandler());
+ handler.start();
+ Invoker processInvoker = new Invoker(serviceDomain, serviceName);
+ Holder holderOne = new Holder();
+ holderOne.setValue("HolderOne");
+ Message processResponse = processInvoker.operation("process").sendInOut(holderOne);
+ Long processInstanceId = (Long)processResponse.getContext().getPropertyValue(PROCESSS_INSTANCE_ID_PROPERTY);
+ Invoker signalInvoker = new Invoker(serviceDomain, serviceName);
+ Holder holderTwo = new Holder();
+ holderTwo.setValue("HolderTwo");
+ Message signalResponse = signalInvoker.operation("signal").property(PROCESSS_INSTANCE_ID_PROPERTY, processInstanceId).sendInOut(holderTwo);
+ Holder holderResponse = signalResponse.getContent(Holder.class);
+ handler.stop();
+ Assert.assertEquals(holderOne.getValue(), testAssertionMap.get("ServiceOne"));
+ Assert.assertEquals(holderTwo.getValue(), testAssertionMap.get("ServiceTwo"));
+ Assert.assertEquals(holderTwo.getValue(), holderResponse.getValue());
+ }
+
+ public static final class Holder {
+ private String _value;
+ public String getValue() { return _value; }
+ public void setValue(String value) { _value = value; }
+ public String toString() { return _value; }
+ }
+
+}
diff --git a/components/bpm/src/test/java/org/switchyard/component/bpm/service/ReuseHandler.java b/components/bpm/src/test/java/org/switchyard/component/bpm/service/ReuseHandler.java
new file mode 100644
index 000000000..11a39730f
--- /dev/null
+++ b/components/bpm/src/test/java/org/switchyard/component/bpm/service/ReuseHandler.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.service;
+
+import org.kie.api.runtime.process.WorkItem;
+import org.kie.api.runtime.process.WorkItemHandler;
+import org.kie.api.runtime.process.WorkItemManager;
+import org.switchyard.component.bpm.service.BPMServiceTests.Holder;
+
+/**
+ * An example handler being reused.
+ *
+ * @author David Ward <dward@jboss.org > © 2012 Red Hat Inc.
+ */
+public class ReuseHandler implements WorkItemHandler {
+
+ static Holder _holder = new Holder();
+
+ @Override
+ public void executeWorkItem(WorkItem workItem, WorkItemManager workItemManager) {
+ _holder.setValue("handler executed");
+ workItemManager.completeWorkItem(workItem.getId(), null);
+ }
+
+ @Override
+ public void abortWorkItem(WorkItem workItem, WorkItemManager workItemManager) {}
+
+}
diff --git a/components/bpm/src/test/java/org/switchyard/component/bpm/session/BPMSessionTests.java b/components/bpm/src/test/java/org/switchyard/component/bpm/session/BPMSessionTests.java
new file mode 100644
index 000000000..44cc61f20
--- /dev/null
+++ b/components/bpm/src/test/java/org/switchyard/component/bpm/session/BPMSessionTests.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm.session;
+
+import javax.xml.namespace.QName;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.kie.api.runtime.KieSession;
+import org.kie.api.runtime.manager.RuntimeEngine;
+import org.switchyard.ServiceDomain;
+import org.switchyard.component.bpm.config.model.BPMComponentImplementationModel;
+import org.switchyard.component.common.knowledge.runtime.KnowledgeRuntimeManager;
+import org.switchyard.component.common.knowledge.runtime.KnowledgeRuntimeManagerFactory;
+import org.switchyard.component.common.knowledge.runtime.KnowledgeRuntimeManagerType;
+import org.switchyard.config.model.ModelPuller;
+import org.switchyard.config.model.switchyard.SwitchYardModel;
+import org.switchyard.deploy.ServiceDomainManager;
+
+/**
+ * Tests BPM sessions.
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+public class BPMSessionTests {
+
+ private static final String GOOD_RESOURCES = "/org/switchyard/component/bpm/session/BPMSessionTests-GoodResources.xml";
+ private static final String BAD_RESOURCES = "/org/switchyard/component/bpm/session/BPMSessionTests-BadResources.xml";
+
+ private ModelPuller _puller;
+
+ @Before
+ public void before() throws Exception {
+ _puller = new ModelPuller();
+ }
+
+ @After
+ public void after() throws Exception {
+ _puller = null;
+ }
+
+ @Test
+ public void testGoodResources() throws Exception {
+ Throwable t = doTestResources(GOOD_RESOURCES);
+ //t.printStackTrace();
+ Assert.assertNull(t);
+ }
+
+ @Test
+ public void testBadResources() throws Exception {
+ Throwable t = doTestResources(BAD_RESOURCES);
+ //t.printStackTrace();
+ Assert.assertNotNull(t);
+ }
+
+ private Throwable doTestResources(String xml) {
+ try {
+ ClassLoader loader = getClass().getClassLoader();
+ SwitchYardModel switchyardModel = _puller.pull(xml, loader);
+ BPMComponentImplementationModel implementationModel = (BPMComponentImplementationModel)switchyardModel.getComposite().getComponents().get(0).getImplementation();
+ ServiceDomain serviceDomain = new ServiceDomainManager().createDomain();
+ QName serviceName = new QName("test");
+ KnowledgeRuntimeManagerFactory runtimeManagerFactory = new KnowledgeRuntimeManagerFactory(loader, serviceDomain, serviceName, implementationModel);
+ KnowledgeRuntimeManager runtimeManager = runtimeManagerFactory.newRuntimeManager(KnowledgeRuntimeManagerType.SINGLETON);
+ RuntimeEngine runtimeEngine = runtimeManager.getRuntimeEngine();
+ KieSession session = runtimeEngine.getKieSession();
+ session.startProcess("TestProcess");
+ runtimeManager.disposeRuntimeEngine(runtimeEngine);
+ runtimeManager.close();
+ return null;
+ } catch (Throwable t) {
+ return t;
+ }
+ }
+
+}
diff --git a/components/bpm/src/test/resources/log4j.properties b/components/bpm/src/test/resources/log4j.properties
new file mode 100644
index 000000000..c52adc99e
--- /dev/null
+++ b/components/bpm/src/test/resources/log4j.properties
@@ -0,0 +1,15 @@
+# The logging properties used during tests
+log4j.rootLogger=INFO, file, stdout
+log4j.logger.org.switchyard.component.bpm=INFO
+
+# Console appender
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.file.file=target/bpm-tests.log
+log4j.appender.file.append=true
diff --git a/components/bpm/src/test/resources/log4j.xml b/components/bpm/src/test/resources/log4j.xml
new file mode 100644
index 000000000..2f567ba68
--- /dev/null
+++ b/components/bpm/src/test/resources/log4j.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpm/src/test/resources/org/switchyard/component/bpm/config/model/BPMModelTests-Container.xml b/components/bpm/src/test/resources/org/switchyard/component/bpm/config/model/BPMModelTests-Container.xml
new file mode 100644
index 000000000..f66c622db
--- /dev/null
+++ b/components/bpm/src/test/resources/org/switchyard/component/bpm/config/model/BPMModelTests-Container.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpm/src/test/resources/org/switchyard/component/bpm/config/model/BPMModelTests-RemoteJms.xml b/components/bpm/src/test/resources/org/switchyard/component/bpm/config/model/BPMModelTests-RemoteJms.xml
new file mode 100644
index 000000000..57dbb460c
--- /dev/null
+++ b/components/bpm/src/test/resources/org/switchyard/component/bpm/config/model/BPMModelTests-RemoteJms.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ java.lang.Object
+ java.lang.String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpm/src/test/resources/org/switchyard/component/bpm/config/model/BPMModelTests-RemoteRest.xml b/components/bpm/src/test/resources/org/switchyard/component/bpm/config/model/BPMModelTests-RemoteRest.xml
new file mode 100644
index 000000000..86e7d7a62
--- /dev/null
+++ b/components/bpm/src/test/resources/org/switchyard/component/bpm/config/model/BPMModelTests-RemoteRest.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ java.lang.Object
+ java.lang.String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpm/src/test/resources/org/switchyard/component/bpm/config/model/BPMModelTests-Resources.xml b/components/bpm/src/test/resources/org/switchyard/component/bpm/config/model/BPMModelTests-Resources.xml
new file mode 100644
index 000000000..0774ec592
--- /dev/null
+++ b/components/bpm/src/test/resources/org/switchyard/component/bpm/config/model/BPMModelTests-Resources.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-AccessAttachment.bpmn b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-AccessAttachment.bpmn
new file mode 100644
index 000000000..dd442e9fb
--- /dev/null
+++ b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-AccessAttachment.bpmn
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+ SequenceFlow_2
+
+
+ SequenceFlow_3
+
+
+ SequenceFlow_2
+ SequenceFlow_3
+
+
+
+
+ DataInput_1
+ DataInput_2
+
+
+
+ Property_1
+ DataInput_1
+
+
+ Property_2
+ DataInput_2
+
+ holder.setValue(new org.switchyard.common.io.pull.StringPuller().pull(attachment.getInputStream()));
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-CallService.bpmn b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-CallService.bpmn
new file mode 100644
index 000000000..d8cd63803
--- /dev/null
+++ b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-CallService.bpmn
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _4_ServiceNameInput
+
+
+
+
+
+ _4_ServiceNameInput
+
+ CallService
+ _4_ServiceNameInput
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-ControlProcess.bpmn b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-ControlProcess.bpmn
new file mode 100644
index 000000000..2b026cd5d
--- /dev/null
+++ b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-ControlProcess.bpmn
@@ -0,0 +1,66 @@
+
+
+
+
+ _1-_5
+
+
+ _4-_3
+
+
+
+ _5-_4
+ _4-_3
+
+
+
+ _4_ServiceNameInput
+
+
+
+
+ _4_ServiceNameInput
+
+ CallService
+ _4_ServiceNameInput
+
+
+
+
+ _1-_5
+ _5-_4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-FaultBoundaryProcess.bpmn b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-FaultBoundaryProcess.bpmn
new file mode 100644
index 000000000..1c0e577a3
--- /dev/null
+++ b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-FaultBoundaryProcess.bpmn
@@ -0,0 +1,122 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ _1-_4
+
+
+ SequenceFlow_4
+
+
+
+
+
+
+
+
+
+
+
+ _1-_4
+ SequenceFlow_8
+
+
+
+ DataInput_ServiceName
+
+
+
+
+ DataInput_ServiceName
+
+ TestService
+ DataInput_ServiceName
+
+
+
+
+
+ SequenceFlow_1
+ SequenceFlow_12
+ System.out.println("********** FaultBoundaryProcess/TestFailureScript *******");
+kcontext.setVariable("TestOutput", "Failure");
+
+
+ SequenceFlow_8
+ SequenceFlow_6
+ System.out.println("********** FaultBoundaryProcess/TestSuccessScript **********");
+kcontext.setVariable("TestOutput", "Success");
+
+
+ SequenceFlow_6
+ SequenceFlow_12
+ SequenceFlow_4
+
+
+
+
+
+
+ SequenceFlow_1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-FaultEventProcess.bpmn b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-FaultEventProcess.bpmn
new file mode 100644
index 000000000..544fa5bb2
--- /dev/null
+++ b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-FaultEventProcess.bpmn
@@ -0,0 +1,173 @@
+
+
+
+
+
+
+
+
+ SequenceFlow_5
+ SequenceFlow_12
+ System.out.println("********** FaultEventProcess/TestFailureScript: " + faultEvent + " **********");
+
+
+
+ SequenceFlow_8
+ SequenceFlow_6
+ System.out.println("********** FaultEventProcess/TestSuccessScript **********");
+
+
+
+ SequenceFlow_4
+
+
+
+
+
+
+
+
+
+
+
+ SequenceFlow_1
+ SequenceFlow_8
+
+
+
+
+
+ DataInput_ServiceName
+ DataInput_1
+ DataInput_6
+
+
+
+
+ DataInput_ServiceName
+
+ TestService
+ DataInput_ServiceName
+
+
+
+ DataInput_1
+
+ FaultSignal
+ DataInput_1
+
+
+
+ DataInput_6
+
+ SKIP
+ DataInput_6
+
+
+
+
+
+ SequenceFlow_12
+ SequenceFlow_6
+ SequenceFlow_4
+
+
+
+ SequenceFlow_2
+ SequenceFlow_5
+
+
+ DataOutput_FaultEvent
+ faultEvent
+
+
+ DataOutput_FaultEvent
+
+
+
+
+
+ _1-_4
+ SequenceFlow_1
+ SequenceFlow_2
+
+
+
+
+ _1-_4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-FaultResultProcess.bpmn b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-FaultResultProcess.bpmn
new file mode 100644
index 000000000..63e014c67
--- /dev/null
+++ b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-FaultResultProcess.bpmn
@@ -0,0 +1,142 @@
+
+
+
+
+
+
+
+ _1-_4
+
+
+ SequenceFlow_4
+
+
+
+ _1-_4
+ SequenceFlow_1
+
+
+
+
+
+
+ DataInput_ServiceName
+ DataInput_FaultName
+ DataInput_1
+
+
+ DataOutput_FaultResult
+
+
+
+ DataInput_ServiceName
+
+ TestService
+ DataInput_ServiceName
+
+
+
+ DataInput_FaultName
+
+ faultResult
+ DataInput_FaultName
+
+
+
+ DataInput_1
+
+ complete
+ DataInput_1
+
+
+
+ DataOutput_FaultResult
+ faultResult
+
+
+
+
+ SequenceFlow_2
+ SequenceFlow_6
+
+
+
+ SequenceFlow_1
+ SequenceFlow_2
+ SequenceFlow_3
+
+
+
+ SequenceFlow_3
+ SequenceFlow_7
+
+
+
+ return (faultResult == null);
+
+
+ return (faultResult != null);
+
+
+ SequenceFlow_6
+ SequenceFlow_7
+ SequenceFlow_4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-ReuseHandler.bpmn b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-ReuseHandler.bpmn
new file mode 100644
index 000000000..67981ec1e
--- /dev/null
+++ b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-ReuseHandler.bpmn
@@ -0,0 +1,43 @@
+
+
+
+
+ _1-_4
+
+
+ _4-_3
+
+
+
+ _1-_4
+ _4-_3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-RulesFired.bpmn b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-RulesFired.bpmn
new file mode 100644
index 000000000..3e8d83fe2
--- /dev/null
+++ b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-RulesFired.bpmn
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+ SequenceFlow_8
+
+
+ SequenceFlow_4
+ SequenceFlow_5
+ insert(((org.kie.api.runtime.process.WorkflowProcessInstance)kcontext.getProcessInstance()).getVariable("holder"));
+
+
+
+ SequenceFlow_5
+ SequenceFlow_8
+
+
+
+ SequenceFlow_4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-RulesFired.drl b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-RulesFired.drl
new file mode 100644
index 000000000..705c288c8
--- /dev/null
+++ b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-RulesFired.drl
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.bpm
+
+import org.switchyard.component.bpm.service.BPMServiceTests.Holder
+
+rule "RulesFired Rule"
+ ruleflow-group "RulesFired Group"
+ when
+ $holder : Holder()
+ then
+ $holder.setValue("rules fired");
+end
diff --git a/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-SignalProcess.bpmn b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-SignalProcess.bpmn
new file mode 100644
index 000000000..e3be023b6
--- /dev/null
+++ b/components/bpm/src/test/resources/org/switchyard/component/bpm/service/BPMServiceTests-SignalProcess.bpmn
@@ -0,0 +1,292 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ SequenceFlow_3
+ SequenceFlow_7
+ SequenceFlow_8
+
+
+
+ SequenceFlow_8
+ SequenceFlow_2
+ System.out.println("******* Process has completed ******** Parameter = " + Parameter);
+System.out.println("******* Process has completed ******** Result = " + Result);
+
+
+
+ SequenceFlow_2
+
+
+
+
+
+
+
+
+
+
+ SequenceFlow_1
+ SequenceFlow_7
+
+
+
+
+
+
+
+
+
+
+
+ _DataInput_9
+ _DataInput_10
+ _DataInput_11
+ _DataInput_12
+ _DataInput_13
+ _DataInput_14
+ _DataInput_15
+ DataInput_2
+
+
+ DataOutput_3
+
+
+
+ _DataInput_9
+
+ ServiceTwo
+ _DataInput_9
+
+
+
+ _DataInput_10
+
+ invoke
+ _DataInput_10
+
+
+
+ _DataInput_11
+
+ Parameter
+ _DataInput_11
+
+
+
+ _DataInput_12
+
+ Result
+ _DataInput_12
+
+
+
+ _DataInput_13
+
+
+ _DataInput_14
+
+
+ _DataInput_15
+
+
+ Parameter
+ DataInput_2
+
+
+ DataOutput_3
+ Result
+
+
+
+
+
+
+
+
+
+
+
+
+ SequenceFlow_5
+ SequenceFlow_3
+
+
+
+
+
+
+
+
+
+
+
+ _DataInput_2
+ _DataInput_3
+ _DataInput_4
+ _DataInput_5
+ _DataInput_6
+ _DataInput_7
+ _DataInput_8
+ DataInput_1
+
+
+ DataOutput_1
+
+
+
+ _DataInput_2
+
+ ServiceOne
+ _DataInput_2
+
+
+
+ _DataInput_3
+
+ invoke
+ _DataInput_3
+
+
+
+ _DataInput_4
+
+ Parameter
+ _DataInput_4
+
+
+
+ _DataInput_5
+
+ Result
+ _DataInput_5
+
+
+
+ _DataInput_6
+
+
+ _DataInput_7
+
+
+ _DataInput_8
+
+
+ Parameter
+ DataInput_1
+
+
+ DataOutput_1
+ Result
+
+
+
+
+ SequenceFlow_6
+ SequenceFlow_1
+
+
+ DataOutput_2
+ Parameter
+
+
+ DataOutput_2
+
+
+
+
+
+ SequenceFlow_4
+
+
+
+ SequenceFlow_4
+ SequenceFlow_5
+ SequenceFlow_6
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/bpm/src/test/resources/org/switchyard/component/bpm/session/BPMSessionTests-BadProcess.bpmn b/components/bpm/src/test/resources/org/switchyard/component/bpm/session/BPMSessionTests-BadProcess.bpmn
new file mode 100644
index 000000000..7cf701385
--- /dev/null
+++ b/components/bpm/src/test/resources/org/switchyard/component/bpm/session/BPMSessionTests-BadProcess.bpmn
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/bpm/src/test/resources/org/switchyard/component/bpm/session/BPMSessionTests-BadResources.xml b/components/bpm/src/test/resources/org/switchyard/component/bpm/session/BPMSessionTests-BadResources.xml
new file mode 100644
index 000000000..b92217af5
--- /dev/null
+++ b/components/bpm/src/test/resources/org/switchyard/component/bpm/session/BPMSessionTests-BadResources.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/bpm/src/test/resources/org/switchyard/component/bpm/session/BPMSessionTests-GoodProcess.bpmn b/components/bpm/src/test/resources/org/switchyard/component/bpm/session/BPMSessionTests-GoodProcess.bpmn
new file mode 100644
index 000000000..ba787be53
--- /dev/null
+++ b/components/bpm/src/test/resources/org/switchyard/component/bpm/session/BPMSessionTests-GoodProcess.bpmn
@@ -0,0 +1,26 @@
+
+
+
+
+ SequenceFlow_1
+
+
+
+ SequenceFlow_1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/bpm/src/test/resources/org/switchyard/component/bpm/session/BPMSessionTests-GoodResources.xml b/components/bpm/src/test/resources/org/switchyard/component/bpm/session/BPMSessionTests-GoodResources.xml
new file mode 100644
index 000000000..bc443314e
--- /dev/null
+++ b/components/bpm/src/test/resources/org/switchyard/component/bpm/session/BPMSessionTests-GoodResources.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/build/src/site/site.xml b/components/build/src/site/site.xml
new file mode 100644
index 000000000..dfe033aa5
--- /dev/null
+++ b/components/build/src/site/site.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ org.apache.maven.skins
+ maven-default-skin
+ 1.0
+
+
+
+
diff --git a/components/camel/camel-amqp/pom.xml b/components/camel/camel-amqp/pom.xml
new file mode 100644
index 000000000..fdfd990df
--- /dev/null
+++ b/components/camel/camel-amqp/pom.xml
@@ -0,0 +1,55 @@
+
+
+
+ 4.0.0
+
+ org.switchyard.components
+ switchyard-component-camel-parent
+ 2.1.0-SNAPSHOT
+
+ switchyard-component-camel-amqp
+ bundle
+ SwitchYard: Camel Component :: AMQP Binding
+
+
+ org.switchyard.component.camel.amqp.*
+
+
+ org.apache.camel.component.amqp,
+ org.switchyard.config.model;org.switchyard.*;${switchyard.osgi.import.switchyard.version},
+ *
+
+
+
+
+ org.switchyard.components
+ switchyard-component-common-camel
+
+
+ org.switchyard.components
+ switchyard-component-camel-jms
+
+
+ org.apache.camel
+ camel-amqp
+ compile
+
+
+ org.switchyard.components
+ switchyard-component-camel-test
+ test
+
+
+
diff --git a/components/camel/camel-amqp/src/main/java/org/switchyard/component/camel/amqp/deploy/CamelAmqpComponent.java b/components/camel/camel-amqp/src/main/java/org/switchyard/component/camel/amqp/deploy/CamelAmqpComponent.java
new file mode 100644
index 000000000..6a319aba1
--- /dev/null
+++ b/components/camel/camel-amqp/src/main/java/org/switchyard/component/camel/amqp/deploy/CamelAmqpComponent.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.amqp.deploy;
+
+import org.switchyard.component.camel.amqp.model.v1.V1CamelAmqpBindingModel;
+import org.switchyard.component.camel.common.deploy.BaseBindingComponent;
+
+/**
+ * AMQP binding component.
+ */
+public class CamelAmqpComponent extends BaseBindingComponent {
+
+ /**
+ * Creates new component.
+ */
+ public CamelAmqpComponent() {
+ super("CamelAmqpComponent", V1CamelAmqpBindingModel.AMQP);
+ }
+
+}
diff --git a/components/camel/camel-amqp/src/main/java/org/switchyard/component/camel/amqp/model/CamelAmqpBindingModel.java b/components/camel/camel-amqp/src/main/java/org/switchyard/component/camel/amqp/model/CamelAmqpBindingModel.java
new file mode 100644
index 000000000..f7ccdd5e1
--- /dev/null
+++ b/components/camel/camel-amqp/src/main/java/org/switchyard/component/camel/amqp/model/CamelAmqpBindingModel.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.amqp.model;
+
+import org.switchyard.component.camel.jms.model.CamelJmsBindingModel;
+
+/**
+ * Represents the configuration settings for an Amqp endpoint in Camel.
+ *
+ * According to the Camel Documentation, Camel JMS and Camel AMQP configurations share
+ * all options, thus the reason to extend {@link GenericMqBindingModel}.
+ *
+ * @author: Eduardo de Vera
+ */
+public interface CamelAmqpBindingModel extends CamelJmsBindingModel {
+}
diff --git a/components/camel/camel-amqp/src/main/java/org/switchyard/component/camel/amqp/model/CamelAmqpNamespace.java b/components/camel/camel-amqp/src/main/java/org/switchyard/component/camel/amqp/model/CamelAmqpNamespace.java
new file mode 100644
index 000000000..3d1281830
--- /dev/null
+++ b/components/camel/camel-amqp/src/main/java/org/switchyard/component/camel/amqp/model/CamelAmqpNamespace.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.amqp.model;
+
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Namespace;
+
+/**
+ * A Camel Amqp config model namespace.
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+public enum CamelAmqpNamespace implements Namespace {
+
+ /** The 1.0 namespace. */
+ V_1_0("1.0"),
+ /** The 1.1 namespace. */
+ V_1_1("1.1"),
+ /** The 2.0 namespace. */
+ V_2_0("2.0"),
+ /** The default namespace. */
+ DEFAULT(null);
+
+ private final Util _util;
+
+ /**
+ * Constructs a new CamelAmqpNamespace with the specified version.
+ * @param version the specified version, or null to discover the default
+ */
+ CamelAmqpNamespace(String version) {
+ _util = new Util(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String section() {
+ return _util.section();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String version() {
+ return _util.version();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean versionMatches(Namespace namespace) {
+ return _util.versionMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String uri() {
+ return _util.uri();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean uriMatches(Namespace namespace) {
+ return _util.uriMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDefault() {
+ return this == DEFAULT || uriMatches(DEFAULT);
+ }
+
+ /**
+ * Gets the CamelAmqpNamespace for the specified uri, or null if no matching uris are found.
+ * @param uri the uri
+ * @return the CamelAmqpNamespace
+ */
+ public static CamelAmqpNamespace fromUri(String uri) {
+ return Util.fromUri(CamelAmqpNamespace.class, uri);
+ }
+
+ @SuppressWarnings("serial")
+ private static final class Util extends Namespace.Util {
+ // static final since we only want to do the somewhat expensive work of instantiating this once!
+ private static final Descriptor DESCRIPTOR = new Descriptor(CamelAmqpNamespace.class);
+ private Util(String version) {
+ super(DESCRIPTOR, "urn:switchyard-component-camel-amqp:config", version);
+ }
+ }
+
+}
diff --git a/components/camel/camel-amqp/src/main/java/org/switchyard/component/camel/amqp/model/v1/V1CamelAmqpBindingModel.java b/components/camel/camel-amqp/src/main/java/org/switchyard/component/camel/amqp/model/v1/V1CamelAmqpBindingModel.java
new file mode 100644
index 000000000..fd36f4eb0
--- /dev/null
+++ b/components/camel/camel-amqp/src/main/java/org/switchyard/component/camel/amqp/model/v1/V1CamelAmqpBindingModel.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.amqp.model.v1;
+
+import java.net.URI;
+
+import org.switchyard.component.camel.amqp.model.CamelAmqpBindingModel;
+import org.switchyard.component.camel.jms.model.v1.V1CamelJmsBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+
+/**
+ * Implementation of {@link CamelAmqpBindingModel}.
+ *
+ * @author: Eduardo de Vera
+ */
+public class V1CamelAmqpBindingModel extends V1CamelJmsBindingModel
+ implements CamelAmqpBindingModel {
+
+ /**
+ * Camel component prefix / binding prefix.
+ */
+ public static final String AMQP = "amqp";
+
+ /**
+ * Default constructor, creates binding using only prefix.
+ * @param namespace namespace
+ */
+ public V1CamelAmqpBindingModel(String namespace) {
+ super(AMQP, namespace);
+ }
+
+ /**
+ * Create a binding from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param descriptor The switchyard descriptor instance.
+ */
+ public V1CamelAmqpBindingModel(Configuration config, Descriptor descriptor) {
+ super(config, descriptor);
+ }
+
+ @Override
+ public URI getComponentURI() {
+ return getComponentURI(AMQP);
+ }
+
+}
diff --git a/components/camel/camel-amqp/src/main/java/org/switchyard/component/camel/amqp/model/v1/V1CamelAmqpModelMarshaller.java b/components/camel/camel-amqp/src/main/java/org/switchyard/component/camel/amqp/model/v1/V1CamelAmqpModelMarshaller.java
new file mode 100644
index 000000000..ca58054d7
--- /dev/null
+++ b/components/camel/camel-amqp/src/main/java/org/switchyard/component/camel/amqp/model/v1/V1CamelAmqpModelMarshaller.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.amqp.model.v1;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelMarshaller;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+import org.switchyard.config.model.composite.BindingModel;
+
+/**
+ * AMQP model marshaller.
+ */
+public class V1CamelAmqpModelMarshaller extends V1BaseCamelMarshaller {
+
+ private static final String BINDING_AMQP = BindingModel.BINDING + '.' + V1CamelAmqpBindingModel.AMQP;
+
+ /**
+ * Creates new marshaller.
+ *
+ * @param desc Descriptor
+ */
+ public V1CamelAmqpModelMarshaller(Descriptor desc) {
+ super(desc);
+ }
+
+ /**
+ * Reads in the Configuration, looking for various knowledge models.
+ * If not found, it falls back to the super class (V1BaseCamelMarshaller).
+ *
+ * @param config the Configuration
+ * @return the Model
+ */
+ @Override
+ public Model read(Configuration config) {
+ String name = config.getName();
+ Descriptor desc = getDescriptor();
+ if (BINDING_AMQP.equals(name)) {
+ return new V1CamelAmqpBindingModel(config, desc);
+ }
+ return super.read(config);
+ }
+
+}
diff --git a/components/camel/camel-amqp/src/main/resources/META-INF/services/org.switchyard.deploy.Component b/components/camel/camel-amqp/src/main/resources/META-INF/services/org.switchyard.deploy.Component
new file mode 100644
index 000000000..6e31fe6d4
--- /dev/null
+++ b/components/camel/camel-amqp/src/main/resources/META-INF/services/org.switchyard.deploy.Component
@@ -0,0 +1 @@
+org.switchyard.component.camel.amqp.deploy.CamelAmqpComponent
diff --git a/components/camel/camel-amqp/src/main/resources/org/switchyard/component/camel/amqp/model/v1/camel-amqp_1_0.xsd b/components/camel/camel-amqp/src/main/resources/org/switchyard/component/camel/amqp/model/v1/camel-amqp_1_0.xsd
new file mode 100644
index 000000000..d27a150a4
--- /dev/null
+++ b/components/camel/camel-amqp/src/main/resources/org/switchyard/component/camel/amqp/model/v1/camel-amqp_1_0.xsd
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-amqp/src/main/resources/org/switchyard/component/camel/amqp/model/v1/camel-amqp_1_1.xsd b/components/camel/camel-amqp/src/main/resources/org/switchyard/component/camel/amqp/model/v1/camel-amqp_1_1.xsd
new file mode 100644
index 000000000..55cf796a2
--- /dev/null
+++ b/components/camel/camel-amqp/src/main/resources/org/switchyard/component/camel/amqp/model/v1/camel-amqp_1_1.xsd
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-amqp/src/main/resources/org/switchyard/component/camel/amqp/model/v2/camel-amqp_2_0.xsd b/components/camel/camel-amqp/src/main/resources/org/switchyard/component/camel/amqp/model/v2/camel-amqp_2_0.xsd
new file mode 100644
index 000000000..a021feb73
--- /dev/null
+++ b/components/camel/camel-amqp/src/main/resources/org/switchyard/component/camel/amqp/model/v2/camel-amqp_2_0.xsd
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-amqp/src/main/resources/org/switchyard/config/model/descriptor.properties b/components/camel/camel-amqp/src/main/resources/org/switchyard/config/model/descriptor.properties
new file mode 100644
index 000000000..45169fe52
--- /dev/null
+++ b/components/camel/camel-amqp/src/main/resources/org/switchyard/config/model/descriptor.properties
@@ -0,0 +1,32 @@
+# Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+
+camel_amqp_1_0.section=urn:switchyard-component-camel-amqp:config
+camel_amqp_1_0.version=1.0
+camel_amqp_1_0.namespace=urn:switchyard-component-camel-amqp:config:1.0
+camel_amqp_1_0.schema=camel-amqp_1_0.xsd
+camel_amqp_1_0.location=/org/switchyard/component/camel/amqp/model/v1/
+camel_amqp_1_0.marshaller=org.switchyard.component.camel.amqp.model.v1.V1CamelAmqpModelMarshaller
+
+camel_amqp_1_1.section=urn:switchyard-component-camel-amqp:config
+camel_amqp_1_1.version=1.1
+camel_amqp_1_1.namespace=urn:switchyard-component-camel-amqp:config:1.1
+camel_amqp_1_1.schema=camel-amqp_1_1.xsd
+camel_amqp_1_1.location=/org/switchyard/component/camel/amqp/model/v1/
+camel_amqp_1_1.marshaller=org.switchyard.component.camel.amqp.model.v1.V1CamelAmqpModelMarshaller
+
+camel_amqp_2_0.section=urn:switchyard-component-camel-amqp:config
+camel_amqp_2_0.version=2.0
+camel_amqp_2_0.namespace=urn:switchyard-component-camel-amqp:config:2.0
+camel_amqp_2_0.schema=camel-amqp_2_0.xsd
+camel_amqp_2_0.location=/org/switchyard/component/camel/amqp/model/v2/
+camel_amqp_2_0.marshaller=org.switchyard.component.camel.amqp.model.v1.V1CamelAmqpModelMarshaller
diff --git a/components/camel/camel-amqp/src/test/java/org/switchyard/component/camel/amqp/model/v1/V1CamelAmqpBindingModelTest.java b/components/camel/camel-amqp/src/test/java/org/switchyard/component/camel/amqp/model/v1/V1CamelAmqpBindingModelTest.java
new file mode 100644
index 000000000..288402ee2
--- /dev/null
+++ b/components/camel/camel-amqp/src/test/java/org/switchyard/component/camel/amqp/model/v1/V1CamelAmqpBindingModelTest.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.amqp.model.v1;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Collections;
+
+import org.apache.camel.component.jms.JmsEndpoint;
+import org.switchyard.component.camel.amqp.model.CamelAmqpNamespace;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+
+/**
+ * Test for amqp binding model.
+ *
+ * @author: Eduardo de Vera
+ */
+public class V1CamelAmqpBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-amqp-binding-beans.xml";
+
+ private static String TOPIC = "esb_in_topic";
+ private static String CONNECTION_FACTORY = "connFactory";
+ private static String USERNAME = "camel";
+ private static String PASSWORD = "isMyFriend";
+ private static String CLIENT_ID = "esb_in";
+ private static String DURABLE_SUBSCRIPTION_NAME = "esb_in_sub";
+ private static Integer CONCURRENT_CONSUMERS = 5;
+ private static Integer MAX_CONCURRENT_CONSUMERS = 15;
+ private static Boolean DISABLE_REPLY_TO = true;
+ private static Boolean PRESERVE_MESSAGE_QOS = true;
+ private static Boolean DELIVERY_PERSISTENT = false;
+ private static Integer PRIORITY = 9;
+ private static Boolean EXPLICIT_QOS_ENABLED = true;
+ private static String REPLY_TO = "esb_out";
+ private static String REPLY_TO_TYPE= "Shared";
+ private static Integer REQUEST_TIMEOUT = 300;
+ private static String SELECTOR = "DEST='ESB'";
+ private static Integer TIME_TO_LIVE = 3600;
+ private static Boolean TRANSACTED = true;
+
+ private static final String CAMEL_URI = "amqp:topic:esb_in_topic?connectionFactory=connFactory&" +
+ "username=camel&password=isMyFriend&clientId=esb_in&durableSubscriptionName=esb_in_sub&" +
+ "concurrentConsumers=5&maxConcurrentConsumers=15&disableReplyTo=true&preserveMessageQos=true&" +
+ "deliveryPersistent=false&priority=9&explicitQosEnabled=true&replyTo=esb_out&replyToType=Shared&" +
+ "requestTimeout=300&selector=DEST='ESB'&timeToLive=3600&transacted=true&dummy=test";
+
+ public V1CamelAmqpBindingModelTest() {
+ super(JmsEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V1CamelAmqpBindingModel createTestModel() {
+ final V1CamelAmqpBindingModel model = new V1CamelAmqpBindingModel(CamelAmqpNamespace.V_1_1.uri());
+ model.setAdditionalUriParameters(createAdditionalUriParametersModel(CamelAmqpNamespace.V_1_1.uri(), Collections.singletonMap("dummy", "test")));
+ model
+ .setTopic(TOPIC)
+ .setConnectionFactory(CONNECTION_FACTORY)
+ .setUsername(USERNAME)
+ .setPassword(PASSWORD)
+ .setClientId(CLIENT_ID)
+ .setDurableSubscriptionName(DURABLE_SUBSCRIPTION_NAME)
+ .setConcurrentConsumers(CONCURRENT_CONSUMERS)
+ .setMaxConcurrentConsumers(MAX_CONCURRENT_CONSUMERS)
+ .setDisableReplyTo(DISABLE_REPLY_TO)
+ .setPreserveMessageQos(PRESERVE_MESSAGE_QOS)
+ .setDeliveryPersistent(DELIVERY_PERSISTENT)
+ .setPriority(PRIORITY)
+ .setExplicitQosEnabled(EXPLICIT_QOS_ENABLED)
+ .setReplyTo(REPLY_TO)
+ .setReplyToType(REPLY_TO_TYPE)
+ .setRequestTimeout(REQUEST_TIMEOUT)
+ .setSelector(SELECTOR)
+ .setTimeToLive(TIME_TO_LIVE)
+ .setTransacted(TRANSACTED);
+ return model;
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelAmqpBindingModel model) {
+ assertEquals(TOPIC, model.getTopic());
+ assertEquals(CONNECTION_FACTORY, model.getConnectionFactory());
+ assertEquals(USERNAME, model.getUsername());
+ assertEquals(PASSWORD, model.getPassword());
+ assertEquals(CLIENT_ID, model.getClientId());
+ assertEquals(DURABLE_SUBSCRIPTION_NAME, model.getDurableSubscriptionName());
+ assertEquals(CONCURRENT_CONSUMERS, model.getConcurrentConsumers());
+ assertEquals(MAX_CONCURRENT_CONSUMERS, model.getMaxConcurrentConsumers());
+ assertEquals(DISABLE_REPLY_TO, model.isDisableReplyTo());
+ assertEquals(PRESERVE_MESSAGE_QOS, model.isPreserveMessageQos());
+ assertEquals(DELIVERY_PERSISTENT, model.isDeliveryPersistent());
+ assertEquals(PRIORITY, model.getPriority());
+ assertEquals(EXPLICIT_QOS_ENABLED, model.isExplicitQosEnabled());
+ assertEquals(REPLY_TO, model.getReplyTo());
+ assertEquals(REPLY_TO_TYPE, model.getReplyToType());
+ assertEquals(REQUEST_TIMEOUT, model.getRequestTimeout());
+ assertEquals(SELECTOR, model.getSelector());
+ assertEquals(TIME_TO_LIVE, model.getTimeToLive());
+ assertEquals(TRANSACTED, model.isTransacted());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-amqp/src/test/resources/v1/switchyard-amqp-binding-beans.xml b/components/camel/camel-amqp/src/test/resources/v1/switchyard-amqp-binding-beans.xml
new file mode 100644
index 000000000..81ff866eb
--- /dev/null
+++ b/components/camel/camel-amqp/src/test/resources/v1/switchyard-amqp-binding-beans.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+ esb_in_topic
+ connFactory
+ camel
+ isMyFriend
+ esb_in
+ esb_in_sub
+ 5
+ 15
+ true
+ true
+ false
+ 9
+ true
+ esb_out
+ Shared
+ 300
+ DEST='ESB'
+ 3600
+ true
+
+
+
+
+
diff --git a/components/camel/camel-atom/pom.xml b/components/camel/camel-atom/pom.xml
new file mode 100644
index 000000000..fe4494a7e
--- /dev/null
+++ b/components/camel/camel-atom/pom.xml
@@ -0,0 +1,69 @@
+
+
+
+ 4.0.0
+
+ org.switchyard.components
+ switchyard-component-camel-parent
+ 2.1.0-SNAPSHOT
+
+ switchyard-component-camel-atom
+ bundle
+ SwitchYard: Camel Component :: Atom Binding
+ http://switchyard.org
+
+
+ org.switchyard.component.camel.atom.*
+
+
+ org.apache.camel.component.atom,
+ org.switchyard.config.model;org.switchyard.*;${switchyard.osgi.import.switchyard.version},
+ *
+
+
+
+
+
+ org.switchyard
+ switchyard-api
+
+
+ org.switchyard.components
+ switchyard-component-common-camel
+
+
+ org.switchyard.components
+ switchyard-component-camel-switchyard
+
+
+ org.apache.abdera
+ abdera-parser
+
+
+ org.apache.camel
+ camel-atom
+ compile
+
+
+ org.switchyard.components
+ switchyard-component-camel-test
+ test
+
+
+
diff --git a/components/camel/camel-atom/src/main/java/org/switchyard/component/camel/atom/deploy/CamelAtomComponent.java b/components/camel/camel-atom/src/main/java/org/switchyard/component/camel/atom/deploy/CamelAtomComponent.java
new file mode 100644
index 000000000..9120a057b
--- /dev/null
+++ b/components/camel/camel-atom/src/main/java/org/switchyard/component/camel/atom/deploy/CamelAtomComponent.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.atom.deploy;
+
+import org.switchyard.component.camel.atom.model.v1.V1CamelAtomBindingModel;
+import org.switchyard.component.camel.common.deploy.BaseBindingComponent;
+
+/**
+ * Atom binding component.
+ */
+public class CamelAtomComponent extends BaseBindingComponent {
+
+ /**
+ * Creates new component.
+ */
+ public CamelAtomComponent() {
+ super("CamelAtomComponent", V1CamelAtomBindingModel.ATOM);
+ }
+
+}
diff --git a/components/camel/camel-atom/src/main/java/org/switchyard/component/camel/atom/model/CamelAtomBindingModel.java b/components/camel/camel-atom/src/main/java/org/switchyard/component/camel/atom/model/CamelAtomBindingModel.java
new file mode 100644
index 000000000..b6024b89d
--- /dev/null
+++ b/components/camel/camel-atom/src/main/java/org/switchyard/component/camel/atom/model/CamelAtomBindingModel.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.atom.model;
+
+import java.net.URI;
+import java.util.Date;
+
+import org.switchyard.component.camel.common.model.CamelBindingModel;
+import org.switchyard.component.camel.common.model.consumer.CamelScheduledPollConsumer;
+
+/**
+ * Represents the configuration settings for an Atom endpoint in Camel. The
+ * Atom component only supports consumer processing, so this binding can only
+ * be used on a service (not a reference).
+ */
+public interface CamelAtomBindingModel extends CamelBindingModel {
+
+ /**
+ * The Atom feed URI which will be polled.
+ * @return the feed URI or null if it has not been specified
+ */
+ URI getFeedURI();
+
+ /**
+ * Set the Atom feed URI.
+ * @param uri feed URI
+ * @return a reference to this Atom binding model
+ */
+ CamelAtomBindingModel setFeedURI(URI uri);
+
+ /**
+ * Whether feed entries will be split on each poll.
+ * @return split setting or null if no configuration has been specified
+ */
+ Boolean isSplitEntries();
+
+ /**
+ * Specify that feed entries will be split on each poll.
+ * @param split true if entries should be split, false otherwise
+ * @return a reference to this Atom binding model
+ */
+ CamelAtomBindingModel setSplitEntries(Boolean split);
+
+ /**
+ * Whether the component should only return new RSS entries.
+ * @return filter setting or null if no configuration has been specified
+ */
+ Boolean isFilter();
+
+ /**
+ * Specify that the source feed should be filtered.
+ * @param filter true to filter the feed
+ * @return a reference to this Atom binding model
+ */
+ CamelAtomBindingModel setFilter(Boolean filter);
+
+ /**
+ * Set the start date used by the filter for pulling new feeds.
+ * @param lastUpdate date after which entries should be pulled
+ * @return a reference to this Atom binding model
+ */
+ CamelAtomBindingModel setLastUpdate(Date lastUpdate);
+
+ /**
+ * The start date used by the filter for pulling new feeds.
+ * @return date after which entries should be pulled or null if no
+ * configuration has been specified
+ */
+ Date getLastUpdate();
+
+ /**
+ * Enables throttled delivery of feeds.
+ * @param throttled specify true to enable throttling
+ * @return a reference to this Atom binding model
+ */
+ CamelAtomBindingModel setThrottleEntries(Boolean throttled);
+
+ /**
+ * Whether throttling is enabled for this endpoint.
+ * @return throttle setting or null if no configuration has been specified
+ */
+ Boolean isThrottleEntries();
+
+ /**
+ * Specify whether the underlying Abdera feed object is included as a header.
+ * @param header true to include the header, false to not include
+ * @return a reference to this Atom binding model
+ */
+ CamelAtomBindingModel setFeedHeader(Boolean header);
+
+ /**
+ * Whether the Abdera feed object is included as a header.
+ * @return feed header setting or null if no configuration has been specified
+ */
+ Boolean isFeedHeader();
+
+ /**
+ * Specifies whether split entries are sorted by date.
+ * @param sorted set to true for split entries to be sorted
+ * @return a reference to this Atom binding model
+ */
+ CamelAtomBindingModel setSortEntries(Boolean sorted);
+
+ /**
+ * Whether split entries are sorted by date.
+ * @return sort setting or null if no configuration has been specified
+ */
+ Boolean isSortEntries();
+
+ /**
+ * Sets consumer properties for atom.
+ *
+ * @param consumer Configuration of consumer.
+ * @return a reference to this Atom binding model
+ */
+ CamelAtomBindingModel setConsumer(CamelScheduledPollConsumer consumer);
+
+ /**
+ * @return Atom consumer configuration.
+ */
+ CamelScheduledPollConsumer getConsumer();
+
+}
diff --git a/components/camel/camel-atom/src/main/java/org/switchyard/component/camel/atom/model/CamelAtomNamespace.java b/components/camel/camel-atom/src/main/java/org/switchyard/component/camel/atom/model/CamelAtomNamespace.java
new file mode 100644
index 000000000..9baeb2cfb
--- /dev/null
+++ b/components/camel/camel-atom/src/main/java/org/switchyard/component/camel/atom/model/CamelAtomNamespace.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.atom.model;
+
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Namespace;
+
+/**
+ * A Camel Atom config model namespace.
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+public enum CamelAtomNamespace implements Namespace {
+
+ /** The 1.0 namespace. */
+ V_1_0("1.0"),
+ /** The 1.1 namespace. */
+ V_1_1("1.1"),
+ /** The 2.0 namespace. */
+ V_2_0("2.0"),
+ /** The default namespace. */
+ DEFAULT(null);
+
+ private final Util _util;
+
+ /**
+ * Constructs a new CamelAtomNamespace with the specified version.
+ * @param version the specified version, or null to discover the default
+ */
+ CamelAtomNamespace(String version) {
+ _util = new Util(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String section() {
+ return _util.section();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String version() {
+ return _util.version();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean versionMatches(Namespace namespace) {
+ return _util.versionMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String uri() {
+ return _util.uri();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean uriMatches(Namespace namespace) {
+ return _util.uriMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDefault() {
+ return this == DEFAULT || uriMatches(DEFAULT);
+ }
+
+ /**
+ * Gets the CamelAtomNamespace for the specified uri, or null if no matching uris are found.
+ * @param uri the uri
+ * @return the CamelAtomNamespace
+ */
+ public static CamelAtomNamespace fromUri(String uri) {
+ return Util.fromUri(CamelAtomNamespace.class, uri);
+ }
+
+ @SuppressWarnings("serial")
+ private static final class Util extends Namespace.Util {
+ // static final since we only want to do the somewhat expensive work of instantiating this once!
+ private static final Descriptor DESCRIPTOR = new Descriptor(CamelAtomNamespace.class);
+ private Util(String version) {
+ super(DESCRIPTOR, "urn:switchyard-component-camel-atom:config", version);
+ }
+ }
+
+}
diff --git a/components/camel/camel-atom/src/main/java/org/switchyard/component/camel/atom/model/v1/V1CamelAtomBindingModel.java b/components/camel/camel-atom/src/main/java/org/switchyard/component/camel/atom/model/v1/V1CamelAtomBindingModel.java
new file mode 100644
index 000000000..8bce7a5e4
--- /dev/null
+++ b/components/camel/camel-atom/src/main/java/org/switchyard/component/camel/atom/model/v1/V1CamelAtomBindingModel.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.atom.model.v1;
+
+import java.net.URI;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import org.switchyard.component.camel.atom.model.CamelAtomBindingModel;
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.common.model.consumer.CamelScheduledPollConsumer;
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelBindingModel;
+import org.switchyard.component.camel.common.model.v1.V1CamelScheduledPollConsumer;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * Implementation of AtomBindingModel.
+ */
+public class V1CamelAtomBindingModel extends V1BaseCamelBindingModel
+ implements CamelAtomBindingModel {
+
+ /**
+ * Camel endpoint type.
+ */
+ public static final String ATOM = "atom";
+
+ /**
+ * Camel endpoint configuration values.
+ */
+ private static final String FEED_URI = "feedURI";
+ private static final String SPLIT_ENTRIES = "splitEntries";
+ private static final String FILTER = "filter";
+ private static final String LAST_UPDATE = "lastUpdate";
+ private static final String THROTTLE_ENTRIES = "throttleEntries";
+ private static final String FEED_HEADER = "feedHeader";
+ private static final String SORT_ENTRIES = "sortEntries";
+
+ private CamelScheduledPollConsumer _consume;
+
+ // Used for dateTime fields
+ private static final String DATE_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ss";
+
+ /**
+ * Create a new AtomBindingModel.
+ * @param namespace namespace
+ */
+ public V1CamelAtomBindingModel(String namespace) {
+ super(ATOM, namespace);
+
+ setModelChildrenOrder(FEED_URI, SPLIT_ENTRIES, FILTER, LAST_UPDATE,
+ THROTTLE_ENTRIES, FEED_HEADER, SORT_ENTRIES, CONSUME);
+ }
+
+ /**
+ * Create a AtomBindingModel from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V1CamelAtomBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ @Override
+ public URI getFeedURI() {
+ String uriStr = getConfig(FEED_URI);
+ if (uriStr != null) {
+ return URI.create(uriStr);
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public V1CamelAtomBindingModel setFeedURI(URI uri) {
+ return setConfig(FEED_URI, uri.toString());
+ }
+
+ @Override
+ public Date getLastUpdate() {
+ final DateFormat lastUpdateDateFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return getDateConfig(LAST_UPDATE, lastUpdateDateFormat);
+ }
+
+ @Override
+ public V1CamelAtomBindingModel setLastUpdate(Date date) {
+ final DateFormat lastUpdateDateFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ setConfig(LAST_UPDATE, lastUpdateDateFormat.format(date));
+ return this;
+ }
+
+ @Override
+ public Boolean isFeedHeader() {
+ return getBooleanConfig(FEED_HEADER);
+ }
+
+ @Override
+ public V1CamelAtomBindingModel setFeedHeader(Boolean feedHeader) {
+ return setConfig(FEED_HEADER, feedHeader);
+ }
+
+ @Override
+ public Boolean isFilter() {
+ return getBooleanConfig(FILTER);
+ }
+
+ @Override
+ public V1CamelAtomBindingModel setFilter(Boolean filtered) {
+ return setConfig(FILTER, filtered);
+ }
+
+ @Override
+ public Boolean isSortEntries() {
+ return getBooleanConfig(SORT_ENTRIES);
+ }
+
+ @Override
+ public V1CamelAtomBindingModel setSortEntries(Boolean sorted) {
+ return setConfig(SORT_ENTRIES, sorted);
+ }
+
+ @Override
+ public Boolean isSplitEntries() {
+ return getBooleanConfig(SPLIT_ENTRIES);
+ }
+
+ @Override
+ public V1CamelAtomBindingModel setSplitEntries(Boolean split) {
+ return setConfig(SPLIT_ENTRIES, String.valueOf(split));
+ }
+
+ @Override
+ public Boolean isThrottleEntries() {
+ return getBooleanConfig(THROTTLE_ENTRIES);
+ }
+
+ @Override
+ public V1CamelAtomBindingModel setThrottleEntries(Boolean throttled) {
+ return setConfig(THROTTLE_ENTRIES, String.valueOf(throttled));
+ }
+
+
+ @Override
+ public CamelScheduledPollConsumer getConsumer() {
+ if (_consume == null) {
+ Configuration config = getModelConfiguration().getFirstChild(CONSUME);
+ _consume = new V1CamelScheduledPollConsumer(config,
+ getModelDescriptor());
+ }
+ return _consume;
+ }
+
+ @Override
+ public V1CamelAtomBindingModel setConsumer(CamelScheduledPollConsumer consumer) {
+ Configuration config = getModelConfiguration().getFirstChild(CONSUME);
+ if (config != null) {
+ // set an existing config value
+ getModelConfiguration().removeChildren(CONSUME);
+ getModelConfiguration().addChild(((V1CamelScheduledPollConsumer) consumer)
+ .getModelConfiguration());
+ } else {
+ setChildModel((V1CamelScheduledPollConsumer) consumer);
+ }
+ _consume = consumer;
+ return this;
+ }
+
+ @Override
+ public URI getComponentURI() {
+ Configuration modelConfiguration = getModelConfiguration();
+ List children = modelConfiguration.getChildren();
+
+ String baseUri = ATOM + "://" + getFeedURI();
+
+ QueryString queryStr = new QueryString();
+ traverseConfiguration(children, queryStr, FEED_URI);
+
+ return URI.create(baseUri + queryStr.toString());
+ }
+}
diff --git a/components/camel/camel-atom/src/main/java/org/switchyard/component/camel/atom/model/v1/V1CamelAtomModelMarshaller.java b/components/camel/camel-atom/src/main/java/org/switchyard/component/camel/atom/model/v1/V1CamelAtomModelMarshaller.java
new file mode 100644
index 000000000..f6ef03cbf
--- /dev/null
+++ b/components/camel/camel-atom/src/main/java/org/switchyard/component/camel/atom/model/v1/V1CamelAtomModelMarshaller.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.atom.model.v1;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelMarshaller;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+import org.switchyard.config.model.composite.BindingModel;
+
+/**
+ * Atom model marshaller.
+ */
+public class V1CamelAtomModelMarshaller extends V1BaseCamelMarshaller {
+
+ private static final String BINDING_ATOM = BindingModel.BINDING + '.' + V1CamelAtomBindingModel.ATOM;
+
+ /**
+ * Creates new marshaller.
+ *
+ * @param desc Descriptor
+ */
+ public V1CamelAtomModelMarshaller(Descriptor desc) {
+ super(desc);
+ }
+
+ /**
+ * Reads in the Configuration, looking for various knowledge models.
+ * If not found, it falls back to the super class (V1BaseCamelMarshaller).
+ *
+ * @param config the Configuration
+ * @return the Model
+ */
+ @Override
+ public Model read(Configuration config) {
+ String name = config.getName();
+ Descriptor desc = getDescriptor();
+ if (BINDING_ATOM.equals(name)) {
+ return new V1CamelAtomBindingModel(config, desc);
+ }
+ return super.read(config);
+ }
+
+}
diff --git a/components/camel/camel-atom/src/main/java/org/switchyard/component/camel/atom/transformer/AtomTransforms.java b/components/camel/camel-atom/src/main/java/org/switchyard/component/camel/atom/transformer/AtomTransforms.java
new file mode 100644
index 000000000..a00e52db6
--- /dev/null
+++ b/components/camel/camel-atom/src/main/java/org/switchyard/component/camel/atom/transformer/AtomTransforms.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.atom.transformer;
+
+import org.apache.abdera.parser.stax.FOMEntry;
+
+import org.switchyard.annotations.Transformer;
+
+/**
+ * Provide a default transformer from org.apache.abdera.parser.stax.FOMEntry->String,
+ * which is useful for creating a simple service using the Camel Atom binding.
+ *
+ * @author tcunning
+ */
+public class AtomTransforms {
+
+ /**
+ * Singleton instance.
+ */
+ public static final AtomTransforms TRANSFORMER = new AtomTransforms();
+
+ /**
+ * Transform FOMEntry->String.
+ * @param entry entry
+ * @return String
+ */
+ @Transformer
+ public String toString(FOMEntry entry) {
+ return entry.toString();
+ }
+
+}
diff --git a/components/camel/camel-atom/src/main/resources/META-INF/services/org.switchyard.deploy.Component b/components/camel/camel-atom/src/main/resources/META-INF/services/org.switchyard.deploy.Component
new file mode 100644
index 000000000..66ef4be38
--- /dev/null
+++ b/components/camel/camel-atom/src/main/resources/META-INF/services/org.switchyard.deploy.Component
@@ -0,0 +1 @@
+org.switchyard.component.camel.atom.deploy.CamelAtomComponent
diff --git a/components/camel/camel-atom/src/main/resources/META-INF/switchyard/transforms.xml b/components/camel/camel-atom/src/main/resources/META-INF/switchyard/transforms.xml
new file mode 100644
index 000000000..11c619769
--- /dev/null
+++ b/components/camel/camel-atom/src/main/resources/META-INF/switchyard/transforms.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/components/camel/camel-atom/src/main/resources/OSGI-INF/blueprint/transformers.xml b/components/camel/camel-atom/src/main/resources/OSGI-INF/blueprint/transformers.xml
new file mode 100644
index 000000000..d7c903944
--- /dev/null
+++ b/components/camel/camel-atom/src/main/resources/OSGI-INF/blueprint/transformers.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/components/camel/camel-atom/src/main/resources/org/switchyard/component/camel/atom/model/v1/camel-atom_1_0.xsd b/components/camel/camel-atom/src/main/resources/org/switchyard/component/camel/atom/model/v1/camel-atom_1_0.xsd
new file mode 100644
index 000000000..299665512
--- /dev/null
+++ b/components/camel/camel-atom/src/main/resources/org/switchyard/component/camel/atom/model/v1/camel-atom_1_0.xsd
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-atom/src/main/resources/org/switchyard/component/camel/atom/model/v1/camel-atom_1_1.xsd b/components/camel/camel-atom/src/main/resources/org/switchyard/component/camel/atom/model/v1/camel-atom_1_1.xsd
new file mode 100644
index 000000000..27900a94c
--- /dev/null
+++ b/components/camel/camel-atom/src/main/resources/org/switchyard/component/camel/atom/model/v1/camel-atom_1_1.xsd
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-atom/src/main/resources/org/switchyard/component/camel/atom/model/v2/camel-atom_2_0.xsd b/components/camel/camel-atom/src/main/resources/org/switchyard/component/camel/atom/model/v2/camel-atom_2_0.xsd
new file mode 100644
index 000000000..40112537a
--- /dev/null
+++ b/components/camel/camel-atom/src/main/resources/org/switchyard/component/camel/atom/model/v2/camel-atom_2_0.xsd
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-atom/src/main/resources/org/switchyard/config/model/descriptor.properties b/components/camel/camel-atom/src/main/resources/org/switchyard/config/model/descriptor.properties
new file mode 100644
index 000000000..c153ee7c8
--- /dev/null
+++ b/components/camel/camel-atom/src/main/resources/org/switchyard/config/model/descriptor.properties
@@ -0,0 +1,32 @@
+# Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+
+camel_atom_1_0.section=urn:switchyard-component-camel-atom:config
+camel_atom_1_0.version=1.0
+camel_atom_1_0.namespace=urn:switchyard-component-camel-atom:config:1.0
+camel_atom_1_0.schema=camel-atom_1_0.xsd
+camel_atom_1_0.location=/org/switchyard/component/camel/atom/model/v1/
+camel_atom_1_0.marshaller=org.switchyard.component.camel.atom.model.v1.V1CamelAtomModelMarshaller
+
+camel_atom_1_1.section=urn:switchyard-component-camel-atom:config
+camel_atom_1_1.version=1.1
+camel_atom_1_1.namespace=urn:switchyard-component-camel-atom:config:1.1
+camel_atom_1_1.schema=camel-atom_1_1.xsd
+camel_atom_1_1.location=/org/switchyard/component/camel/atom/model/v1/
+camel_atom_1_1.marshaller=org.switchyard.component.camel.atom.model.v1.V1CamelAtomModelMarshaller
+
+camel_atom_2_0.section=urn:switchyard-component-camel-atom:config
+camel_atom_2_0.version=2.0
+camel_atom_2_0.namespace=urn:switchyard-component-camel-atom:config:2.0
+camel_atom_2_0.schema=camel-atom_2_0.xsd
+camel_atom_2_0.location=/org/switchyard/component/camel/atom/model/v2/
+camel_atom_2_0.marshaller=org.switchyard.component.camel.atom.model.v1.V1CamelAtomModelMarshaller
diff --git a/components/camel/camel-atom/src/test/java/org/switchyard/component/camel/atom/model/v1/V1CamelAtomBindingModelTest.java b/components/camel/camel-atom/src/test/java/org/switchyard/component/camel/atom/model/v1/V1CamelAtomBindingModelTest.java
new file mode 100644
index 000000000..674464d83
--- /dev/null
+++ b/components/camel/camel-atom/src/test/java/org/switchyard/component/camel/atom/model/v1/V1CamelAtomBindingModelTest.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.atom.model.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.net.URI;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.camel.component.feed.FeedEndpoint;
+import org.switchyard.component.camel.atom.model.CamelAtomNamespace;
+import org.switchyard.component.camel.common.model.consumer.CamelScheduledPollConsumer;
+import org.switchyard.component.camel.common.model.v1.V1CamelScheduledPollConsumer;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+
+/**
+ * Test of atom binding model.
+ */
+public class V1CamelAtomBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-atom-binding.xml";
+
+ private static final String CAMEL_URI =
+ "atom://file:///dev/null?feedHeader=true&filter=true&lastUpdate=2011-01-01T12:00:00"
+ + "&sortEntries=true&splitEntries=true&throttleEntries=true"
+ + "&delay=15000&initialDelay=20000&useFixedDelay=true";
+
+ private Date referenceDate;
+ private static final URI FEED_URI = URI.create("file:///dev/null");
+ private static final Boolean FEED_HEADER = true;
+ private static final Boolean FILTERED = true;
+ private static final Boolean SORTED = true;
+ private static final Boolean SPLIT = true;
+ private static final Boolean THROTTLED = true;
+
+ public V1CamelAtomBindingModelTest() throws ParseException {
+ super(FeedEndpoint.class, CAMEL_XML);
+
+ referenceDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss")
+ .parse("2011-01-01T12:00:00");
+ }
+
+
+ @Override
+ protected void createModelAssertions(V1CamelAtomBindingModel model) {
+ assertEquals(FEED_URI, model.getFeedURI());
+ assertEquals(referenceDate.toString(), model.getLastUpdate().toString());
+ assertEquals(FEED_HEADER, model.isFeedHeader());
+ assertEquals(FILTERED, model.isFilter());
+ assertEquals(SORTED, model.isSortEntries());
+ assertEquals(SPLIT, model.isSplitEntries());
+ assertEquals(THROTTLED, model.isThrottleEntries());
+ }
+
+ @Override
+ protected V1CamelAtomBindingModel createTestModel() {
+ V1CamelAtomBindingModel abm = new V1CamelAtomBindingModel(CamelAtomNamespace.V_1_0.uri())
+ .setFeedURI(FEED_URI)
+ .setSplitEntries(SPLIT)
+ .setFilter(FILTERED)
+ .setLastUpdate(referenceDate)
+ .setThrottleEntries(THROTTLED)
+ .setFeedHeader(FEED_HEADER)
+ .setSortEntries(SORTED);
+
+ CamelScheduledPollConsumer consumer = new V1CamelScheduledPollConsumer(CamelAtomNamespace.V_1_0.uri(), V1CamelAtomBindingModel.CONSUME)
+ .setInitialDelay(20000)
+ .setDelay(15000)
+ .setUseFixedDelay(true);
+ return abm.setConsumer(consumer);
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-atom/src/test/resources/v1/switchyard-atom-binding.xml b/components/camel/camel-atom/src/test/resources/v1/switchyard-atom-binding.xml
new file mode 100644
index 000000000..eb02539c1
--- /dev/null
+++ b/components/camel/camel-atom/src/test/resources/v1/switchyard-atom-binding.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+ file:///dev/null
+ true
+ true
+ 2011-01-01T12:00:00
+ true
+ true
+ true
+
+ 20000
+ 15000
+ true
+
+
+
+
+
+
diff --git a/components/camel/camel-core/Readme.md b/components/camel/camel-core/Readme.md
new file mode 100644
index 000000000..8733c2dfa
--- /dev/null
+++ b/components/camel/camel-core/Readme.md
@@ -0,0 +1,242 @@
+# SwitchYard Camel Component
+This project deals with integrating Apache Camel with SwitchYard.
+
+## Using Apache Camel components as gateways/entrypoint into SwitchYard
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+In the configuration above you see an example of a service that is using a Camel binding. What will happen is that SwitchYard
+will create a CamelContext add add a route for the configured component, which is identified in this case using the *configUri*
+attribute. This route will look like this for the above configuration:
+
+ from("direct://input").to("switchyard://SimpleCamelService?operationName=print");
+
+The *operationName* is optional if the Service only has a single method and can left out in that case.
+
+_ _ _
+
+## Using SwitchYard reference bindings with Apache Camel
+A configuration of a reference binding could look like this:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+In this configuration we have defined a reference binding which has specified a configURI attribute which identifies the
+Camel endpoint to be called. The *OrderComponent* is configured with an implementation of the *OrderService* interface and
+a concreate implementation of *OrderServiceImpl*:
+
+ public interface OrderService {
+ public String getTitleForItem(String itemId);
+ }
+
+ import javax.inject.Inject;
+
+ import org.switchyard.component.bean.Reference;
+ import org.switchyard.component.bean.Service;
+
+ @Service(OrderService.class)
+ public class OrderServiceImpl implements OrderService {
+
+ @Inject @Reference
+ WarehouseService _warehouseService;
+
+ @Override
+ public String getTitleForItem(String itemId) {
+ return _warehouseService.hasItem(itemId);
+ }
+ }
+Notice that *OrderServiceImpl* requires a *WarehouseService* instance. This is declared in the configuration using the
+reference element on the *OrderComponent* and SwitchYard will inject a proxy that will delegate to the Camel endpoint.
+
+---
+# Transactions with Camel Service Bindings
+Certain Camel Components support transactions, for example the JMS Component, and there are a few options that can be configured which
+will be described in this section.
+
+## Local Transaction configuration
+A Service Binding for Camel using the JMS Component with a local transaction can look like this:
+
+
+This configures a JMS Component to use a local transaction. This means that if the route, in our case this is the
+route that sends the JMS Message content to the target SwitchYard Service, completes successfully the transaction will
+be committed. If the route does not end successfully, for example an exception is thrown from the Service Implementation,
+the transaction will be rolled back and the message will still be in the JMS Brokers queue.
+
+**Note: The default transaction error handler will determine the policy for redelivery and this is currently not configurable. This is something that we going to attend to for the next 0.4 release.**
+
+## JTA Transaction configuration
+Using local transactions as described in the previous example is nice for cases where the service implementation does
+not need to take part of the same transaction. If for example your service implementation does require participation, for
+example if it persists data to a database, you will need to configure a JTA transaction manager that will coordinate the
+transaction.
+The following examples shows how to configure a JTA transaction manager:
+
+
+
+The _#jtaTransactionManager_ is a reference to a bean in the Camel Registry. This would normally be configured using Spring XML
+when outside of SwitchYard. Is is possible to specify a custom transaction manager by using a CDI bean which will be describe
+later in this document. By default though, if you configure the _transactionManager_ to be _#jtaTransactionManager_, SwitchYard will
+perform lookups in JNDI to try to determine which TransactionManager to use to drive the transactions. The order is as follows:
+
+1. java:jboss/UserTransaction
+2. java:comp/UserTransaction
+
+
+## Custom Transaction Manager
+If you are deploying SwitchYard in an environment that does not have the transaction managers available that were listed in
+ the previous section you can use CDI to have a JTA Transaction Manager injected into the Camel Registry.
+Example of a custom JTA Transaction Manager using CDI:
+
+ import javax.enterprise.context.ApplicationScoped;
+ import javax.enterprise.inject.Produces;
+ import javax.inject.Named;
+
+ import org.springframework.transaction.PlatformTransactionManager;
+ import org.springframework.transaction.jta.JtaTransactionManager;
+
+ @ApplicationScoped
+ public class CustomTransactionManager {
+
+ @Produces @Named ("myTransactionManager")
+ public PlatformTransactionManager create() {
+ final JtaTransactionManager transactionManager = new JtaTransactionManager();
+ transactionManager.setUserTransactionName("UserTransactionJndiName");
+ transactionManager.setTransactionManagerName("TransactionManagerJndiName");
+ transactionManager.setTransactionSynchronizationRegistryName("TransactionSynchronizationRegistryJndiName");
+ transactionManager.afterPropertiesSet();
+ return transactionManager;
+ }
+
+ }
+
+_ _ _
+## Using SwitchYard implementation.camel with Apache Camel
+A Camel route can be used as the implementation for a service. This is done by using the *implementation.camel* element which can contain a Camel route.
+SwitchYard takes care of creating a service for the interface which sole purpose is to trigger the Camel route. It does this by creating a *from* route
+that triggers the Camel route. This allows SwitchYard clients to use the service interface to invoke the Camel route.
+
+For example:
+
+ route.xml :
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+As you can see in the above configuration that the route in *implementation.camel* does not contain a *from* route. Switchyard will add a *from* route for the service.
+
+The above would be invokable by using the following code from a SwitchYard test:
+
+ String title = newInvoker("OrderService").operation("getTitleForItem").sendInOut("10").getContent(String.class);
+
+Running the above code snippet would generate the following in you console log:
+
+ 10:57:45,915 INFO [impl.DefaultCamelContext] Apache Camel 2.6.0 (CamelContext: camel-1) started in 0.838 seconds
+ 10:57:46,284 INFO [impl.DefaultCamelContext] Route: Camel Test Route started and consuming from: Endpoint[switchyard://OrderService]
+ 10:57:46,307 INFO [impl.DefaultCamelContext] Apache Camel 2.6.0 (CamelContext: camel-1) is starting
+ 10:57:46,307 INFO [impl.DefaultCamelContext] Total 1 routes, of which 1 is started.
+ 10:57:46,307 INFO [impl.DefaultCamelContext] Apache Camel 2.6.0 (CamelContext: camel-1) started in 0.000 seconds
+ 10:57:46,428 INFO [Camel Test Route] ItemId [10]
+ 10:57:46,434 INFO [Camel Test Route] Title Name [Fletch]
+
+Notice the Camel Endpoint **switchyard://OrderService**, this is the endpoint that SwitchYard generates and can be configured by setting the schema property like demonstrated above.
+
+---
+## SwitchYard Transformers and Camel's TypeConverters
+SwitchYard has build in transformers and custom transformers can be registered with the runtime. Camel has TypeConverters
+that basically perform similar tasks.
+
+SwitchYards Camel component provides a SwitchYard transformer that delegates to Camel's TypeConverters. To accomplish this the different type of converters have to be registered with SwitchYard as transformers. This is currently a static file, *META-INF/switchyard/transforms.xml*
+which is parsed by SwitchYard. In future versions these will be dynamically registred with SwitchYard.
+
+If users have customer Camel TypeConverters they can be specified by either adding them to the transforms.xml in the SwitchYard Camel component or they
+can add a transforms.xml to there deployment archive.
+
+_ _ _
+
+## Calling a SwitchYard service from Apache Camel:
+
+
+
+
+
+
+
+
+
+
+_ _ _
diff --git a/components/camel/camel-core/pom.xml b/components/camel/camel-core/pom.xml
new file mode 100644
index 000000000..f95c72052
--- /dev/null
+++ b/components/camel/camel-core/pom.xml
@@ -0,0 +1,60 @@
+
+
+
+ 4.0.0
+
+ org.switchyard.components
+ switchyard-component-camel-parent
+ 2.1.0-SNAPSHOT
+
+ switchyard-component-camel-core
+ bundle
+ SwitchYard: Camel Component :: Core Binding
+ http://switchyard.org
+
+
+ org.switchyard.component.camel.core.*
+
+
+ org.switchyard.config.model;org.switchyard.*;${switchyard.osgi.import.switchyard.version},
+ *
+
+
+
+
+
+ org.switchyard.components
+ switchyard-component-common-camel
+
+
+ org.switchyard.components
+ switchyard-component-camel-switchyard
+
+
+ org.apache.camel
+ camel-core
+ compile
+
+
+ org.switchyard.components
+ switchyard-component-camel-test
+ test
+
+
+
diff --git a/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/deploy/CamelCoreComponent.java b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/deploy/CamelCoreComponent.java
new file mode 100644
index 000000000..8513bb2b0
--- /dev/null
+++ b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/deploy/CamelCoreComponent.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.core.deploy;
+
+import org.switchyard.component.camel.common.deploy.BaseBindingComponent;
+import org.switchyard.component.camel.core.model.v1.V1CamelUriBindingModel;
+import org.switchyard.component.camel.core.model.v1.V1CamelDirectBindingModel;
+import org.switchyard.component.camel.core.model.v1.V1CamelMockBindingModel;
+import org.switchyard.component.camel.core.model.v1.V1CamelSedaBindingModel;
+import org.switchyard.component.camel.core.model.v1.V1CamelTimerBindingModel;
+
+/**
+ * Camel core component. Supports camel-core bindings.
+ */
+public class CamelCoreComponent extends BaseBindingComponent {
+
+ /**
+ * Creates new core binding component.
+ */
+ public CamelCoreComponent() {
+ super("CamelCoreComponent",
+ V1CamelUriBindingModel.URI,
+ V1CamelDirectBindingModel.DIRECT,
+ V1CamelSedaBindingModel.SEDA,
+ V1CamelTimerBindingModel.TIMER,
+ V1CamelMockBindingModel.MOCK
+ );
+ }
+
+}
diff --git a/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/deploy/CamelMockBindingModel.java b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/deploy/CamelMockBindingModel.java
new file mode 100644
index 000000000..96f9a3356
--- /dev/null
+++ b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/deploy/CamelMockBindingModel.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.core.deploy;
+
+import org.switchyard.component.camel.common.model.CamelBindingModel;
+
+/**
+ * Represents the configuration settings for a Mock endpoint in Camel.
+ *
+ * The Mock component provides a powerful declarative testing mechanism,
+ * which is similar to jMock in that it allows declarative expectations
+ * to be created on any Mock endpoint before a test begins. Then the test
+ * is run, which typically fires messages to one or more endpoints, and
+ * finally the expectations can be asserted in a test case to ensure the
+ * system worked as expected.
+ *
+ * @author Mario Antollini
+ *
+ */
+public interface CamelMockBindingModel extends CamelBindingModel {
+
+ /**
+ * The name that uniquely identifies the endpoint.
+ * @return The name that uniquely identifies the endpoint
+ */
+ String getEndpointName();
+
+ /**
+ * The name that uniquely identifies the endpoint.
+ * @param name the name that uniquely identifies the endpoint
+ * @return a reference to this Mock binding model
+ */
+ CamelMockBindingModel setEndpointName(String name);
+
+ /**
+ * An integer that specifies a group size for throughput logging.
+ * @return the group size for throughput logging
+ */
+ Integer getReportGroup();
+
+ /**
+ * Specify a group size for throughput logging.
+ * @param size the group size for throughput logging
+ * @return a reference to this Mock binding model
+ */
+ CamelMockBindingModel setReportGroup(Integer size);
+
+}
diff --git a/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/CamelCoreNamespace.java b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/CamelCoreNamespace.java
new file mode 100644
index 000000000..245506760
--- /dev/null
+++ b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/CamelCoreNamespace.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.core.model;
+
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Namespace;
+
+/**
+ * A Camel Core config model namespace.
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+public enum CamelCoreNamespace implements Namespace {
+
+ /** The 1.0 namespace. */
+ V_1_0("1.0"),
+ /** The 1.1 namespace. */
+ V_1_1("1.1"),
+ /** The 2.0 namespace. */
+ V_2_0("2.0"),
+ /** The default namespace. */
+ DEFAULT(null);
+
+ private final Util _util;
+
+ /**
+ * Constructs a new CamelCoreNamespace with the specified version.
+ * @param version the specified version, or null to discover the default
+ */
+ CamelCoreNamespace(String version) {
+ _util = new Util(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String section() {
+ return _util.section();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String version() {
+ return _util.version();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean versionMatches(Namespace namespace) {
+ return _util.versionMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String uri() {
+ return _util.uri();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean uriMatches(Namespace namespace) {
+ return _util.uriMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDefault() {
+ return this == DEFAULT || uriMatches(DEFAULT);
+ }
+
+ /**
+ * Gets the CamelCoreNamespace for the specified uri, or null if no matching uris are found.
+ * @param uri the uri
+ * @return the CamelCoreNamespace
+ */
+ public static CamelCoreNamespace fromUri(String uri) {
+ return Util.fromUri(CamelCoreNamespace.class, uri);
+ }
+
+ @SuppressWarnings("serial")
+ private static final class Util extends Namespace.Util {
+ // static final since we only want to do the somewhat expensive work of instantiating this once!
+ private static final Descriptor DESCRIPTOR = new Descriptor(CamelCoreNamespace.class);
+ private Util(String version) {
+ super(DESCRIPTOR, "urn:switchyard-component-camel-core:config", version);
+ }
+ }
+
+}
diff --git a/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/CamelDirectBindingModel.java b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/CamelDirectBindingModel.java
new file mode 100644
index 000000000..2c62cd063
--- /dev/null
+++ b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/CamelDirectBindingModel.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.core.model;
+
+import org.switchyard.component.camel.common.model.CamelBindingModel;
+
+/**
+ * Represents the configuration settings for a Direct endpoint in Camel. The
+ * direct component provides direct, synchronous invocation of any consumers
+ * when a producer sends a message exchange. This endpoint can be used to
+ * connect existing routes in the same camel context.
+ */
+public interface CamelDirectBindingModel extends CamelBindingModel {
+
+ /**
+ * The name can be any String to uniquely identify the endpoint.
+ * @return the unique identifier for the endpoint
+ */
+ String getEndpointName();
+
+ /**
+ * The name can be any String to uniquely identify the endpoint.
+ * @param name the unique identifier for the endpoint
+ * @return a reference to this Direct binding model
+ */
+ CamelDirectBindingModel setEndpointName(String name);
+
+}
diff --git a/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/CamelSedaBindingModel.java b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/CamelSedaBindingModel.java
new file mode 100644
index 000000000..7813368e5
--- /dev/null
+++ b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/CamelSedaBindingModel.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.core.model;
+
+import org.switchyard.component.camel.common.model.CamelBindingModel;
+
+/**
+ * Represents the configuration settings for a SEDA endpoint in Camel.
+ *
+ * The SEDA component provides asynchronous SEDA behavior, so that messages
+ * are exchanged on a BlockingQueue and consumers are invoked in a separate
+ * thread from the producer.
+ * Note that queues are only visible within a single CamelContext. If you
+ * want to communicate across CamelContext instances (for example,
+ * communicating between Web applications), see the VM component. This
+ * component does not implement any kind of persistence or recovery, if
+ * the VM terminates while messages are yet to be processed. If you need
+ * persistence, reliability or distributed SEDA, try using either JMS
+ * or ActiveMQ.
+ *
+ * @author Mario Antollini
+ */
+public interface CamelSedaBindingModel extends CamelBindingModel {
+
+ /**
+ * The name that uniquely identifies the endpoint within the
+ * current CamelContext.
+ * @return The name that uniquely identifies the endpoint within the
+ * current CamelContext
+ */
+ String getEndpointName();
+
+ /**
+ * The name that uniquely identifies the endpoint within the
+ * current CamelContext.
+ * @param name the name that uniquely identifies the endpoint within the
+ * current CamelContext
+ * @return a reference to this SEDA binding model
+ */
+ CamelSedaBindingModel setEndpointName(String name);
+
+ /**
+ * The maximum size (= capacity of the number of messages it can max hold)
+ * of the SEDA queue.
+ * @return the maximum size of the SEDA queue
+ */
+ Integer getSize();
+
+ /**
+ * Specify the maximum size (= capacity of the number of messages it can
+ * max hold) of the SEDA queue.
+ * @param size the number of messages it can max hold
+ * @return a reference to this SEDA binding model
+ */
+ CamelSedaBindingModel setSize(Integer size);
+
+ /**
+ * Number of concurrent threads processing exchanges.
+ * @return the number of concurrent threads processing exchanges.
+ */
+ Integer getConcurrentConsumers();
+
+ /**
+ * Specify the number of concurrent threads processing exchanges.
+ * @param concurrentConsumers the number of concurrent threads
+ * @return a reference to this SEDA binding model
+ */
+ CamelSedaBindingModel setConcurrentConsumers(Integer concurrentConsumers);
+
+ /**
+ * Whether the caller should wait for the async task to complete or not
+ * before continuing.
+ * @return one of the following: Always, Never or IfReplyExpected. The
+ * first two values are self-explanatory. The last value, IfReplyExpected,
+ * will only wait if the message is Request Reply based.
+ */
+ String getWaitForTaskToComplete();
+
+ /**
+ * Specify whether the caller should wait for the async task to complete or not
+ * before continuing. The following three options are supported: Always,
+ * Never or IfReplyExpected.
+ * The first two values are self-explanatory. The last value, IfReplyExpected,
+ * will only wait if the message is Request Reply based.
+ * The default option is IfReplyExpected.
+ * @param waitForTaskToComplete The following three options are supported: Always,
+ * Never or IfReplyExpected
+ * @return a reference to this SEDA binding model
+ */
+ CamelSedaBindingModel setWaitForTaskToComplete(String waitForTaskToComplete);
+
+ /**
+ * Timeout in milliseconds a SEDA producer will at most waiting for an async
+ * task to complete.
+ * @return the time in milliseconds
+ */
+ Long getTimeout();
+
+ /**
+ * Timeout in milliseconds a SEDA producer will at most waiting for an async
+ * task to complete.
+ * @param timeout the timeout in milliseconds
+ * @return a reference to this SEDA binding model
+ */
+ CamelSedaBindingModel setTimeout(Long timeout);
+
+ /**
+ * Whether multiple consumers is allowed or not.
+ * @return true if multiple consumers is allowed; false otherwise
+ */
+ Boolean isMultipleConsumers();
+
+ /**
+ * Specify whether multiple consumers is allowed or not. If enabled you can
+ * use SEDA for a pubsub kinda style messaging. Send a message to a SEDA queue and
+ * have multiple consumers receive a copy of the message.
+ * @param multipleConsumers true if multiple consumers is allowed; false
+ * otherwise
+ * @return a reference to this SEDA binding model
+ */
+ CamelSedaBindingModel setMultipleConsumers(Boolean multipleConsumers);
+
+ /**
+ * Whether to limit the concurrentConsumers to maximum 500.
+ * If its configured with a higher number an exception will be thrown.
+ * @return true if the limit is enabled; false if the limit is disabled
+ */
+ Boolean isLimitConcurrentConsumers();
+
+ /**
+ * Whether to limit the concurrentConsumers to maximum 500.
+ * If its configured with a higher number an exception will be thrown.
+ * @param limitConcurrentConsumers true to limit to 500; false otherwise
+ * @return a reference to this SEDA binding model
+ */
+ CamelSedaBindingModel setLimitConcurrentConsumers(Boolean limitConcurrentConsumers);
+}
diff --git a/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/CamelTimerBindingModel.java b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/CamelTimerBindingModel.java
new file mode 100644
index 000000000..3e0ea3650
--- /dev/null
+++ b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/CamelTimerBindingModel.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.core.model;
+
+import java.util.Date;
+
+import org.switchyard.component.camel.common.model.CamelBindingModel;
+
+/**
+ * Represents the configuration settings for Camel Timer binding.
+ *
+ * @author Mario Antollini
+ */
+public interface CamelTimerBindingModel extends CamelBindingModel {
+
+ /**
+ * The timer name.
+ * @return the timer name
+ */
+ String getTimerName();
+
+ /**
+ * Specify the timer name.
+ * @param name the timer name
+ * @return a reference to this Camel Timer binding model
+ */
+ CamelTimerBindingModel setTimerName(String name);
+
+ /**
+ * A java.util.Date the first event should be generated.
+ * If using the URI, the pattern expected is: yyyy-MM-dd HH:mm:ss
+ * or yyyy-MM-dd'T'HH:mm:ss.
+ * @return the first event date
+ */
+ Date getTime();
+
+ /**
+ * Specify the java.util.Date the first event should be generated.
+ * If using the URI, the pattern expected is: yyyy-MM-dd HH:mm:ss
+ * or yyyy-MM-dd'T'HH:mm:ss
+ * @param time the specified first event date
+ * @return a reference to this Camel Timer binding model
+ */
+ CamelTimerBindingModel setTime(Date time);
+
+ /**
+ * A custom Date pattern to use for setting the time option using URI syntax.
+ * @return the custom Date pattern
+ */
+ String getPattern();
+
+ /**
+ * Specify a custom Date pattern to use for setting the time option
+ * using URI syntax.
+ * @param pattern the custom Date pattern
+ * @return a reference to this Camel Timer binding model
+ */
+ CamelTimerBindingModel setPattern(String pattern);
+
+ /**
+ * The time in milliseconds to generate periodic events.
+ * @return the period in milliseconds
+ */
+ Long getPeriod();
+
+ /**
+ * If greater than 0, generate periodic events every period milliseconds.
+ * @param period the period in milliseconds
+ * @return a reference to this Camel Timer binding model
+ */
+ CamelTimerBindingModel setPeriod(Long period);
+
+ /**
+ * The number of milliseconds to wait before the first event is generated.
+ * @return the number of milliseconds to wait before the first event
+ */
+ Long getDelay();
+
+ /**
+ * Specify the number of milliseconds to wait before the first event is
+ * generated.
+ * Should not be used in conjunction with the time option.
+ * @param delay The number of milliseconds to wait
+ * @return a reference to this Camel Timer binding model
+ */
+ CamelTimerBindingModel setDelay(Long delay);
+
+ /**
+ * Events take place at approximately regular intervals, separated by
+ * the specified period.
+ * @return true if events take place at regular intervals, false otherwihse
+ */
+ Boolean isFixedRate();
+
+ /**
+ * Specify whether events take place at approximately regular intervals, separated by
+ * the specified period.
+ * @param fixedRate whether events take place at approximately regular intervals (true),
+ * or not (false)
+ * @return a reference to this Camel Timer binding model
+ */
+ CamelTimerBindingModel setFixedRate(Boolean fixedRate);
+
+ /**
+ * Whether or not the thread associated with the timer endpoint
+ * runs as a daemon.
+ * @return true if the thread runs as a daemon, false otherwise
+ */
+ Boolean isDaemon();
+
+ /**
+ * Specify whether or not the thread associated with the timer endpoint
+ * runs as a daemon.
+ * @param daemon true if the thread runs as a daemon, false otherwise
+ * @return a reference to this Camel Timer binding model
+ */
+ CamelTimerBindingModel setDaemon(Boolean daemon);
+
+}
diff --git a/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelCoreModelMarshaller.java b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelCoreModelMarshaller.java
new file mode 100644
index 000000000..976aa8068
--- /dev/null
+++ b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelCoreModelMarshaller.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.core.model.v1;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelMarshaller;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+import org.switchyard.config.model.composite.BindingModel;
+
+/**
+ * A Marshaler that is able to read a {@link Configuration} and populate a
+ * corresponding Model to the configuration informations.
+ *
+ *
+ * @author Daniel Bevenius
+ */
+public class V1CamelCoreModelMarshaller extends V1BaseCamelMarshaller {
+
+ private static final String BINDING_URI = BindingModel.BINDING + '.' + V1CamelUriBindingModel.URI;
+ private static final String BINDING_DIRECT = BindingModel.BINDING + '.' + V1CamelDirectBindingModel.DIRECT;
+ private static final String BINDING_TIMER = BindingModel.BINDING + '.' + V1CamelTimerBindingModel.TIMER;
+ private static final String BINDING_SEDA = BindingModel.BINDING + '.' + V1CamelSedaBindingModel.SEDA;
+ private static final String BINDING_MOCK = BindingModel.BINDING + '.' + V1CamelMockBindingModel.MOCK;
+
+ /**
+ * Sole constructor.
+ *
+ * @param desc The switchyard descriptor.
+ */
+ public V1CamelCoreModelMarshaller(Descriptor desc) {
+ super(desc);
+ }
+
+ /**
+ * Reads in the Configuration, looking for various knowledge models.
+ * If not found, it falls back to the super class (V1BaseCamelMarshaller).
+ *
+ * @param config the Configuration
+ * @return the Model
+ */
+ @Override
+ public Model read(Configuration config) {
+ String name = config.getName();
+ Descriptor desc = getDescriptor();
+ if (BINDING_URI.equals(name)) {
+ return new V1CamelUriBindingModel(config, desc);
+ } else if (BINDING_DIRECT.equals(name)) {
+ return new V1CamelDirectBindingModel(config, desc);
+ } else if (BINDING_TIMER.equals(name)) {
+ return new V1CamelTimerBindingModel(config, desc);
+ } else if (BINDING_SEDA.equals(name)) {
+ return new V1CamelSedaBindingModel(config, desc);
+ } else if (BINDING_MOCK.equals(name)) {
+ return new V1CamelMockBindingModel(config, desc);
+ }
+ return super.read(config);
+ }
+
+}
diff --git a/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelDirectBindingModel.java b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelDirectBindingModel.java
new file mode 100644
index 000000000..a286839a0
--- /dev/null
+++ b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelDirectBindingModel.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.core.model.v1;
+
+import java.net.URI;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelBindingModel;
+import org.switchyard.component.camel.core.model.CamelDirectBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * Implementation of AtomBindingModel.
+ */
+public class V1CamelDirectBindingModel extends V1BaseCamelBindingModel
+ implements CamelDirectBindingModel {
+
+ /**
+ * Camel endpoint type.
+ */
+ public static final String DIRECT = "direct";
+
+ /**
+ * Camel endpoint configuration values.
+ */
+ private static final String NAME = "name";
+
+ /**
+ * Create a new CamelDirectBindingModel.
+ * @param namespace namespace
+ */
+ public V1CamelDirectBindingModel(String namespace) {
+ super(DIRECT, namespace);
+
+ setModelChildrenOrder(NAME);
+ }
+
+ /**
+ * Create a CamelDirectBindingModel from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V1CamelDirectBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ @Override
+ public String getEndpointName() {
+ return getConfig(NAME);
+ }
+
+ @Override
+ public V1CamelDirectBindingModel setEndpointName(String name) {
+ return setConfig(NAME, name);
+ }
+
+ @Override
+ public URI getComponentURI() {
+ // base URI without params
+ String uriStr = DIRECT + "://" + getConfig(NAME);
+ return URI.create(uriStr.toString());
+ }
+
+}
diff --git a/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelMockBindingModel.java b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelMockBindingModel.java
new file mode 100644
index 000000000..9de52f942
--- /dev/null
+++ b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelMockBindingModel.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.core.model.v1;
+
+import java.net.URI;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelBindingModel;
+import org.switchyard.component.camel.core.deploy.CamelMockBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * Represents the configuration settings for Camel Mock binding.
+ *
+ * @author Mario Antollini
+ */
+public class V1CamelMockBindingModel extends V1BaseCamelBindingModel
+ implements CamelMockBindingModel {
+
+ /**
+ * Camel endpoint type.
+ */
+ public static final String MOCK = "mock";
+
+ /**
+ * Camel endpoint configuration values.
+ */
+ private static final String NAME = "name";
+ private static final String REPORT_GROUP = "reportGroup";
+
+ /**
+ * Create a new CamelMockBindingModel.
+ * @param namespace namespace
+ */
+ public V1CamelMockBindingModel(String namespace) {
+ super(MOCK, namespace);
+
+ setModelChildrenOrder(NAME, REPORT_GROUP);
+ }
+
+ /**
+ * Create a CamelMockBindingModel from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V1CamelMockBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ @Override
+ public String getEndpointName() {
+ return getConfig(NAME);
+ }
+
+ @Override
+ public V1CamelMockBindingModel setEndpointName(String name) {
+ return setConfig(NAME, name);
+ }
+
+ @Override
+ public Integer getReportGroup() {
+ return getIntegerConfig(REPORT_GROUP);
+ }
+
+ @Override
+ public V1CamelMockBindingModel setReportGroup(Integer reportGroup) {
+ return setConfig(REPORT_GROUP, String.valueOf(reportGroup));
+ }
+
+ @Override
+ public URI getComponentURI() {
+ // base URI without params
+ String uriStr = MOCK + "://" + getConfig(NAME);
+ // create query string from config values
+ QueryString queryStr = new QueryString().add(REPORT_GROUP, getConfig(REPORT_GROUP));
+
+ return URI.create(uriStr.toString() + queryStr);
+ }
+
+
+}
diff --git a/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelSedaBindingModel.java b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelSedaBindingModel.java
new file mode 100644
index 000000000..dce16ec3f
--- /dev/null
+++ b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelSedaBindingModel.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.core.model.v1;
+
+import java.net.URI;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelBindingModel;
+import org.switchyard.component.camel.core.model.CamelSedaBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * Represents the configuration settings for Camel Timer binding.
+ *
+ * @author Mario Antollini
+ */
+public class V1CamelSedaBindingModel extends V1BaseCamelBindingModel
+ implements CamelSedaBindingModel {
+
+ /**
+ * Camel endpoint type.
+ */
+ public static final String SEDA = "seda";
+
+ /**
+ * Camel Seda configuration values.
+ */
+ private static final String NAME = "name";
+ private static final String SIZE = "size";
+ private static final String CONCURRENT_CONSUMERS = "concurrentConsumers";
+ private static final String WAIT_FOR_TASK_TO_COMPLETE = "waitForTaskToComplete";
+ private static final String TIMEOUT = "timeout";
+ private static final String MULTIPLE_CONSUMERS = "multipleConsumers";
+ private static final String LIMIT_CONCURRENT_CONSUMERS = "limitConcurrentConsumers";
+
+ /**
+ * Create a new CamelSedaBindingModel.
+ * @param namespace namespace
+ */
+ public V1CamelSedaBindingModel(String namespace) {
+ super(SEDA, namespace);
+
+ setModelChildrenOrder(NAME, SIZE, CONCURRENT_CONSUMERS, WAIT_FOR_TASK_TO_COMPLETE,
+ TIMEOUT, MULTIPLE_CONSUMERS, LIMIT_CONCURRENT_CONSUMERS);
+ }
+
+ /**
+ * Create a CamelSedaBindingModel from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V1CamelSedaBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ @Override
+ public String getEndpointName() {
+ return getConfig(NAME);
+ }
+
+ @Override
+ public V1CamelSedaBindingModel setEndpointName(String name) {
+ return setConfig(NAME, name);
+ }
+
+ @Override
+ public Integer getSize() {
+ return getIntegerConfig(SIZE);
+ }
+
+ @Override
+ public V1CamelSedaBindingModel setSize(Integer size) {
+ return setConfig(SIZE, String.valueOf(size));
+ }
+
+ @Override
+ public Integer getConcurrentConsumers() {
+ return getIntegerConfig(CONCURRENT_CONSUMERS);
+ }
+
+ @Override
+ public V1CamelSedaBindingModel setConcurrentConsumers(Integer concurrentConsumers) {
+ return setConfig(CONCURRENT_CONSUMERS, concurrentConsumers);
+ }
+
+ @Override
+ public String getWaitForTaskToComplete() {
+ return getConfig(WAIT_FOR_TASK_TO_COMPLETE);
+ }
+
+ @Override
+ public V1CamelSedaBindingModel setWaitForTaskToComplete(String waitForTaskToComplete) {
+ return setConfig(WAIT_FOR_TASK_TO_COMPLETE, waitForTaskToComplete);
+ }
+
+ @Override
+ public Long getTimeout() {
+ return getLongConfig(TIMEOUT);
+ }
+
+ @Override
+ public V1CamelSedaBindingModel setTimeout(Long timeout) {
+ return setConfig(TIMEOUT, timeout);
+ }
+
+ @Override
+ public Boolean isMultipleConsumers() {
+ return getBooleanConfig(MULTIPLE_CONSUMERS);
+ }
+
+ @Override
+ public V1CamelSedaBindingModel setMultipleConsumers(Boolean multipleConsumers) {
+ return setConfig(MULTIPLE_CONSUMERS, multipleConsumers);
+ }
+
+ @Override
+ public Boolean isLimitConcurrentConsumers() {
+ return getBooleanConfig(LIMIT_CONCURRENT_CONSUMERS);
+ }
+
+ @Override
+ public V1CamelSedaBindingModel setLimitConcurrentConsumers(Boolean limitConcurrentConsumers) {
+ return setConfig(LIMIT_CONCURRENT_CONSUMERS, limitConcurrentConsumers);
+ }
+
+ @Override
+ public URI getComponentURI() {
+ String uriStr = SEDA + "://" + getConfig(NAME);
+ // create query string from config values
+ QueryString queryString = new QueryString();
+ traverseConfiguration(getModelConfiguration().getChildren(), queryString, NAME);
+
+ return URI.create(uriStr.toString() + queryString);
+ }
+
+}
diff --git a/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelTimerBindingModel.java b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelTimerBindingModel.java
new file mode 100644
index 000000000..8deb464a4
--- /dev/null
+++ b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelTimerBindingModel.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.core.model.v1;
+
+import java.net.URI;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelBindingModel;
+import org.switchyard.component.camel.core.model.CamelTimerBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * Represents the configuration settings for Camel Timer binding.
+ *
+ * @author Mario Antollini
+ */
+public class V1CamelTimerBindingModel extends V1BaseCamelBindingModel
+ implements CamelTimerBindingModel {
+
+ /**
+ * Camel endpoint type.
+ */
+ public static final String TIMER = "timer";
+
+ /**
+ * Date format string.
+ */
+ public static final String DATE_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ss";
+
+ /**
+ * Camel endpoint configuration values.
+ */
+ private static final String NAME = "name";
+ private static final String TIME = "time";
+ private static final String PATTERN = "pattern";
+ private static final String PERIOD = "period";
+ private static final String DELAY = "delay";
+ private static final String FIXED_RATE = "fixedRate";
+ private static final String DAEMON = "daemon";
+
+ /**
+ * Create a new CamelTimerBindingModel.
+ * @param namespace namespace
+ */
+ public V1CamelTimerBindingModel(String namespace) {
+ super(TIMER, namespace);
+
+ setModelChildrenOrder(NAME, TIME, PATTERN, PERIOD, DELAY, FIXED_RATE, DAEMON);
+ }
+
+ /**
+ * Create a CamelTimerBindingModel from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V1CamelTimerBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ @Override
+ public String getTimerName() {
+ return getConfig(NAME);
+ }
+
+ @Override
+ public V1CamelTimerBindingModel setTimerName(String name) {
+ return setConfig(NAME, name);
+ }
+
+ @Override
+ public Date getTime() {
+ final DateFormat dateConfigFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return getDateConfig(TIME, dateConfigFormat);
+ }
+
+ @Override
+ public V1CamelTimerBindingModel setTime(Date time) {
+ final DateFormat timeDateFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return setConfig(TIME, timeDateFormat.format(time));
+ }
+
+ @Override
+ public String getPattern() {
+ return getConfig(PATTERN);
+ }
+
+ @Override
+ public V1CamelTimerBindingModel setPattern(String pattern) {
+ return setConfig(PATTERN, pattern);
+ }
+
+ @Override
+ public Long getPeriod() {
+ return getLongConfig(PERIOD);
+ }
+
+ @Override
+ public V1CamelTimerBindingModel setPeriod(Long period) {
+ return setConfig(PERIOD, period);
+ }
+
+ @Override
+ public Long getDelay() {
+ return getLongConfig(DELAY);
+ }
+
+ @Override
+ public V1CamelTimerBindingModel setDelay(Long delay) {
+ return setConfig(DELAY, delay);
+ }
+
+ @Override
+ public Boolean isFixedRate() {
+ return getBooleanConfig(FIXED_RATE);
+ }
+
+ @Override
+ public V1CamelTimerBindingModel setFixedRate(Boolean fixedRate) {
+ return setConfig(FIXED_RATE, fixedRate);
+ }
+
+ @Override
+ public Boolean isDaemon() {
+ return getBooleanConfig(DAEMON);
+ }
+
+ @Override
+ public V1CamelTimerBindingModel setDaemon(Boolean daemon) {
+ return setConfig(DAEMON, daemon);
+ }
+
+ @Override
+ public URI getComponentURI() {
+ // base URI without params
+ String uriStr = TIMER + "://" + getConfig(NAME);
+ // create query string from config values
+ QueryString queryStr = new QueryString();
+ traverseConfiguration(getModelConfiguration().getChildren(), queryStr, NAME);
+
+ return URI.create(uriStr.toString() + queryStr);
+ }
+
+
+
+}
diff --git a/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelUriBindingModel.java b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelUriBindingModel.java
new file mode 100644
index 000000000..d5eb9a8ba
--- /dev/null
+++ b/components/camel/camel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelUriBindingModel.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.core.model.v1;
+
+import java.net.URI;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * A generic binding definintion for Apache Camel components.
+ *
+ * Example of a binding implemem
+ * .tation:
+ *
+ * {@code
+ *
+ *
+ *
+ *
+ *
+ * }
+ *
+ *
+ *
+ * The 'configURI' attribute can be used to specify a Camel component uri.
+ *
+ *
+ * @author Daniel Bevenius
+ */
+public class V1CamelUriBindingModel extends V1BaseCamelBindingModel {
+
+ /**
+ * The binding type (binding.camel).
+ */
+ public static final String URI = "uri";
+
+ /**
+ * This is the name of the uri attribute.
+ */
+ public static final String CONFIG_URI = "configURI";
+
+ /**
+ * This is the name of the transacted attribute.
+ */
+ public static final String TRANSACTED = "transacted";
+
+ /**
+ * The name of the transacedRef attribute.
+ */
+ public static final String TRANSACTED_REF = "transactedRef";
+
+ /**
+ * Create a new CamelBindingModel.
+ * @param namespace namespace
+ */
+ public V1CamelUriBindingModel(String namespace) {
+ super(URI, namespace);
+ }
+
+ /**
+ * Create a CamelBindingModel from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V1CamelUriBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ setModelChildrenOrder();
+ }
+
+ /**
+ * Gets the binding uri attribute from the underlying model.
+ *
+ * @return URI The binding uri attribute.
+ */
+ public URI getConfigURI() {
+ return java.net.URI.create(getModelAttribute(CONFIG_URI));
+ }
+
+ /**
+ * Sets the "uri" element on the underlying model.
+ *
+ * @param uri The Camel Component URI
+ * @return {@link org.switchyard.component.camel.common.model.CamelBindingModel CamelBindingModel} to support method chaining.
+ */
+ public V1CamelUriBindingModel setConfigURI(URI uri) {
+ setModelAttribute(CONFIG_URI, uri.toString());
+ return this;
+ }
+
+ @Override
+ public URI getComponentURI() {
+ return getConfigURI();
+ }
+
+}
diff --git a/components/camel/camel-core/src/main/resources/META-INF/services/org.switchyard.deploy.Component b/components/camel/camel-core/src/main/resources/META-INF/services/org.switchyard.deploy.Component
new file mode 100644
index 000000000..0ccc55f15
--- /dev/null
+++ b/components/camel/camel-core/src/main/resources/META-INF/services/org.switchyard.deploy.Component
@@ -0,0 +1 @@
+org.switchyard.component.camel.core.deploy.CamelCoreComponent
\ No newline at end of file
diff --git a/components/camel/camel-core/src/main/resources/org/switchyard/component/camel/core/model/v1/camel-core_1_0.xsd b/components/camel/camel-core/src/main/resources/org/switchyard/component/camel/core/model/v1/camel-core_1_0.xsd
new file mode 100644
index 000000000..6e695d057
--- /dev/null
+++ b/components/camel/camel-core/src/main/resources/org/switchyard/component/camel/core/model/v1/camel-core_1_0.xsd
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-core/src/main/resources/org/switchyard/component/camel/core/model/v1/camel-core_1_1.xsd b/components/camel/camel-core/src/main/resources/org/switchyard/component/camel/core/model/v1/camel-core_1_1.xsd
new file mode 100644
index 000000000..052c4fc26
--- /dev/null
+++ b/components/camel/camel-core/src/main/resources/org/switchyard/component/camel/core/model/v1/camel-core_1_1.xsd
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-core/src/main/resources/org/switchyard/component/camel/core/model/v2/camel-core_2_0.xsd b/components/camel/camel-core/src/main/resources/org/switchyard/component/camel/core/model/v2/camel-core_2_0.xsd
new file mode 100644
index 000000000..f61df21f9
--- /dev/null
+++ b/components/camel/camel-core/src/main/resources/org/switchyard/component/camel/core/model/v2/camel-core_2_0.xsd
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-core/src/main/resources/org/switchyard/config/model/descriptor.properties b/components/camel/camel-core/src/main/resources/org/switchyard/config/model/descriptor.properties
new file mode 100644
index 000000000..15d51ef69
--- /dev/null
+++ b/components/camel/camel-core/src/main/resources/org/switchyard/config/model/descriptor.properties
@@ -0,0 +1,32 @@
+# Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+
+camel_core_1_0.section=urn:switchyard-component-camel-core:config
+camel_core_1_0.version=1.0
+camel_core_1_0.namespace=urn:switchyard-component-camel-core:config:1.0
+camel_core_1_0.schema=camel-core_1_0.xsd
+camel_core_1_0.location=/org/switchyard/component/camel/core/model/v1/
+camel_core_1_0.marshaller=org.switchyard.component.camel.core.model.v1.V1CamelCoreModelMarshaller
+
+camel_core_1_1.section=urn:switchyard-component-camel-core:config
+camel_core_1_1.version=1.1
+camel_core_1_1.namespace=urn:switchyard-component-camel-core:config:1.1
+camel_core_1_1.schema=camel-core_1_1.xsd
+camel_core_1_1.location=/org/switchyard/component/camel/core/model/v1/
+camel_core_1_1.marshaller=org.switchyard.component.camel.core.model.v1.V1CamelCoreModelMarshaller
+
+camel_core_2_0.section=urn:switchyard-component-camel-core:config
+camel_core_2_0.version=2.0
+camel_core_2_0.namespace=urn:switchyard-component-camel-core:config:2.0
+camel_core_2_0.schema=camel-core_2_0.xsd
+camel_core_2_0.location=/org/switchyard/component/camel/core/model/v2/
+camel_core_2_0.marshaller=org.switchyard.component.camel.core.model.v1.V1CamelCoreModelMarshaller
diff --git a/components/camel/camel-core/src/test/java/org/switchyard/component/camel/config/model/v1/V1CamelDirectBindingModelTest.java b/components/camel/camel-core/src/test/java/org/switchyard/component/camel/config/model/v1/V1CamelDirectBindingModelTest.java
new file mode 100644
index 000000000..9e4d543a9
--- /dev/null
+++ b/components/camel/camel-core/src/test/java/org/switchyard/component/camel/config/model/v1/V1CamelDirectBindingModelTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.config.model.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.camel.component.direct.DirectEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.core.model.CamelCoreNamespace;
+import org.switchyard.component.camel.core.model.v1.V1CamelUriBindingModel;
+import org.switchyard.component.camel.core.model.v1.V1CamelDirectBindingModel;
+
+/**
+ * Test for {@link V1CamelUriBindingModel}.
+ *
+ * @author Mario Antollini
+ */
+public class V1CamelDirectBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "switchyard-direct-binding-beans.xml";
+
+ private static final String NAME = "fooDirectName";
+
+ private static final String CAMEL_URI = "direct://fooDirectName";
+
+ public V1CamelDirectBindingModelTest() {
+ super(DirectEndpoint.class, CAMEL_XML);
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelDirectBindingModel model) {
+ assertEquals(NAME, model.getEndpointName());
+ }
+
+ @Override
+ protected V1CamelDirectBindingModel createTestModel() {
+ return new V1CamelDirectBindingModel(CamelCoreNamespace.V_1_0.uri()).setEndpointName(NAME);
+ }
+
+}
\ No newline at end of file
diff --git a/components/camel/camel-core/src/test/java/org/switchyard/component/camel/config/model/v1/V1CamelMockBindingModelTest.java b/components/camel/camel-core/src/test/java/org/switchyard/component/camel/config/model/v1/V1CamelMockBindingModelTest.java
new file mode 100644
index 000000000..4f7224931
--- /dev/null
+++ b/components/camel/camel-core/src/test/java/org/switchyard/component/camel/config/model/v1/V1CamelMockBindingModelTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.config.model.v1;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.camel.component.mock.MockEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.core.model.CamelCoreNamespace;
+import org.switchyard.component.camel.core.model.v1.V1CamelUriBindingModel;
+import org.switchyard.component.camel.core.model.v1.V1CamelMockBindingModel;
+
+/**
+ * Test for {@link V1CamelUriBindingModel}.
+ *
+ * @author Mario Antollini
+ */
+public class V1CamelMockBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "switchyard-mock-binding-beans.xml";
+
+ private static final String NAME = "fooMockName";
+ private static final Integer REPORT_GROUP = new Integer(999);
+
+ private static final String CAMEL_URI = "mock://fooMockName?reportGroup=999";
+
+ public V1CamelMockBindingModelTest() {
+ super(MockEndpoint.class, CAMEL_XML);
+ }
+
+ @Override
+ protected V1CamelMockBindingModel createTestModel() {
+ return new V1CamelMockBindingModel(CamelCoreNamespace.V_1_0.uri()).setEndpointName(NAME).setReportGroup(REPORT_GROUP);
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelMockBindingModel model) {
+ assertEquals(NAME, model.getEndpointName());
+ assertEquals(REPORT_GROUP, model.getReportGroup());
+ }
+
+}
\ No newline at end of file
diff --git a/components/camel/camel-core/src/test/java/org/switchyard/component/camel/config/model/v1/V1CamelReferenceBindingModelTest.java b/components/camel/camel-core/src/test/java/org/switchyard/component/camel/config/model/v1/V1CamelReferenceBindingModelTest.java
new file mode 100644
index 000000000..5125c5f11
--- /dev/null
+++ b/components/camel/camel-core/src/test/java/org/switchyard/component/camel/config/model/v1/V1CamelReferenceBindingModelTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.config.model.v1;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URI;
+
+import org.apache.camel.component.direct.DirectEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelReferenceBindingModelTest;
+import org.switchyard.component.camel.core.model.CamelCoreNamespace;
+import org.switchyard.component.camel.core.model.v1.V1CamelUriBindingModel;
+
+/**
+ * Test for {@link V1CamelUriBindingModel}.
+ *
+ * @author Daniel Bevenius
+ */
+public class V1CamelReferenceBindingModelTest extends V1BaseCamelReferenceBindingModelTest {
+
+ private final static String CAMEL_XML = "switchyard-camel-ref-beans.xml";
+ private final static String CAMEL_URI = "direct://input";
+
+ public V1CamelReferenceBindingModelTest() {
+ super(DirectEndpoint.class, CAMEL_XML);
+ }
+
+ @Override
+ protected V1CamelUriBindingModel createTestModel() {
+ return new V1CamelUriBindingModel(CamelCoreNamespace.V_1_0.uri())
+ .setConfigURI(URI.create("direct://input"));
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelUriBindingModel model) {
+ assertEquals("uri", model.getType());
+ assertEquals("direct", model.getConfigURI().getScheme());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-core/src/test/java/org/switchyard/component/camel/config/model/v1/V1CamelSedaBindingModelTest.java b/components/camel/camel-core/src/test/java/org/switchyard/component/camel/config/model/v1/V1CamelSedaBindingModelTest.java
new file mode 100644
index 000000000..0607fa104
--- /dev/null
+++ b/components/camel/camel-core/src/test/java/org/switchyard/component/camel/config/model/v1/V1CamelSedaBindingModelTest.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.config.model.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.camel.component.seda.SedaEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.core.model.CamelCoreNamespace;
+import org.switchyard.component.camel.core.model.v1.V1CamelUriBindingModel;
+import org.switchyard.component.camel.core.model.v1.V1CamelSedaBindingModel;
+
+/**
+ * Test for {@link V1CamelUriBindingModel}.
+ *
+ * @author Mario Antollini
+ */
+public class V1CamelSedaBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "switchyard-seda-binding-beans.xml";
+
+ private static final String NAME = "fooSedaName";
+ private static final Integer SIZE = new Integer(55);
+ private static final Integer CONCURRENT_CONSUMERS = new Integer(3);
+ private static final String WAIT_FOR_TASK_TO_COMPLETE = "Always";
+ private static final Long TIMEOUT = new Long(1000);
+ private static final Boolean MULTIPLE_CONSUMERS = Boolean.TRUE;
+ private static final Boolean LIMIT_CONCURRENT_CONSUMERS = Boolean.FALSE;
+
+ private static final String CAMEL_URI = "seda://fooSedaName?size=55" +
+ "&waitForTaskToComplete=Always&concurrentConsumers=3" +
+ "&timeout=1000&multipleConsumers=true&limitConcurrentConsumers=false";
+
+ public V1CamelSedaBindingModelTest() {
+ super(SedaEndpoint.class, CAMEL_XML);
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelSedaBindingModel model) {
+ assertEquals(NAME, model.getEndpointName());
+ assertEquals(SIZE, model.getSize());
+ assertEquals(CONCURRENT_CONSUMERS, model.getConcurrentConsumers());
+ assertEquals(WAIT_FOR_TASK_TO_COMPLETE, model.getWaitForTaskToComplete());
+ assertEquals(TIMEOUT, model.getTimeout());
+ assertEquals(MULTIPLE_CONSUMERS, model.isMultipleConsumers());
+ assertEquals(LIMIT_CONCURRENT_CONSUMERS, model.isLimitConcurrentConsumers());
+ }
+
+ @Override
+ protected V1CamelSedaBindingModel createTestModel() {
+ return new V1CamelSedaBindingModel(CamelCoreNamespace.V_1_0.uri()).setEndpointName(NAME)
+ .setSize(SIZE)
+ .setConcurrentConsumers(CONCURRENT_CONSUMERS)
+ .setWaitForTaskToComplete(WAIT_FOR_TASK_TO_COMPLETE)
+ .setTimeout(TIMEOUT)
+ .setMultipleConsumers(MULTIPLE_CONSUMERS)
+ .setLimitConcurrentConsumers(LIMIT_CONCURRENT_CONSUMERS);
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
\ No newline at end of file
diff --git a/components/camel/camel-core/src/test/java/org/switchyard/component/camel/config/model/v1/V1CamelServiceBindingModelTest.java b/components/camel/camel-core/src/test/java/org/switchyard/component/camel/config/model/v1/V1CamelServiceBindingModelTest.java
new file mode 100644
index 000000000..226190730
--- /dev/null
+++ b/components/camel/camel-core/src/test/java/org/switchyard/component/camel/config/model/v1/V1CamelServiceBindingModelTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.config.model.v1;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URI;
+
+import org.apache.camel.component.direct.DirectEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.core.model.CamelCoreNamespace;
+import org.switchyard.component.camel.core.model.v1.V1CamelUriBindingModel;
+
+/**
+ * Test for {@link V1CamelUriBindingModel}.
+ *
+ * @author Daniel Bevenius
+ */
+public class V1CamelServiceBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private final static String CAMEL_XML = "switchyard-camel-binding-beans.xml";
+ private final static String CAMEL_URI = "direct://input";
+
+ public V1CamelServiceBindingModelTest() {
+ super(DirectEndpoint.class, CAMEL_XML);
+ }
+
+ @Override
+ protected V1CamelUriBindingModel createTestModel() {
+ return new V1CamelUriBindingModel(CamelCoreNamespace.V_1_0.uri())
+ .setConfigURI(URI.create("direct://input"));
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelUriBindingModel model) {
+ assertEquals("uri", model.getType());
+ assertEquals("direct", model.getConfigURI().getScheme());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-core/src/test/java/org/switchyard/component/camel/config/model/v1/V1CamelTimerBindingModelTest.java b/components/camel/camel-core/src/test/java/org/switchyard/component/camel/config/model/v1/V1CamelTimerBindingModelTest.java
new file mode 100644
index 000000000..cdab47057
--- /dev/null
+++ b/components/camel/camel-core/src/test/java/org/switchyard/component/camel/config/model/v1/V1CamelTimerBindingModelTest.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+
+package org.switchyard.component.camel.config.model.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.camel.component.timer.TimerEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.core.model.CamelCoreNamespace;
+import org.switchyard.component.camel.core.model.v1.V1CamelUriBindingModel;
+import org.switchyard.component.camel.core.model.v1.V1CamelTimerBindingModel;
+
+/**
+ * Test for {@link V1CamelUriBindingModel}.
+ *
+ * @author Mario Antollini
+ */
+public class V1CamelTimerBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "switchyard-timer-binding-beans.xml";
+
+ private static final String NAME = "fooTimer";
+ private static final String PATTERN = "yyyy-MM-dd'T'HH:mm:ss";
+ private static final Long PERIOD = new Long(555);
+ private static final Long DELAY = new Long(100);
+ private static final Boolean FIXED_RATE = Boolean.TRUE;
+ private static final Boolean DAEMON = Boolean.FALSE;
+
+ private static final String CAMEL_URI =
+ "timer://fooTimer?time=2011-01-01T12:00:00&pattern=yyyy-MM-dd'T'HH:mm:ss&" +
+ "period=555&delay=100&fixedRate=true&daemon=false";
+
+ private Date referenceDate;
+
+ public V1CamelTimerBindingModelTest() throws ParseException {
+ super(TimerEndpoint.class, CAMEL_XML);
+
+ referenceDate = new SimpleDateFormat(PATTERN).parse("2011-01-01T12:00:00");
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelTimerBindingModel model) {
+ assertEquals(NAME, model.getTimerName());
+ assertEquals(referenceDate.toString(), model.getTime().toString());
+ assertEquals(PATTERN, model.getPattern());
+ assertEquals(PERIOD, model.getPeriod());
+ assertEquals(DELAY, model.getDelay());
+ assertEquals(FIXED_RATE, model.isFixedRate());
+ assertEquals(DAEMON, model.isDaemon());
+ }
+
+ @Override
+ protected V1CamelTimerBindingModel createTestModel() {
+ return new V1CamelTimerBindingModel(CamelCoreNamespace.V_1_0.uri()).setTimerName(NAME)
+ .setTime(referenceDate)
+ .setPattern(PATTERN)
+ .setPeriod(PERIOD)
+ .setDelay(DELAY)
+ .setFixedRate(FIXED_RATE)
+ .setDaemon(DAEMON);
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-camel-binding-beans.xml b/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-camel-binding-beans.xml
new file mode 100644
index 000000000..3083d56a9
--- /dev/null
+++ b/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-camel-binding-beans.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-camel-ref-beans.xml b/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-camel-ref-beans.xml
new file mode 100644
index 000000000..a7f16d319
--- /dev/null
+++ b/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-camel-ref-beans.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-direct-binding-beans.xml b/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-direct-binding-beans.xml
new file mode 100644
index 000000000..2f9e9cbfd
--- /dev/null
+++ b/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-direct-binding-beans.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+ fooDirectName
+
+
+
+
+
diff --git a/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-mock-binding-beans.xml b/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-mock-binding-beans.xml
new file mode 100644
index 000000000..0550f0704
--- /dev/null
+++ b/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-mock-binding-beans.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+ fooMockName
+ 999
+
+
+
+
+
diff --git a/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-seda-binding-beans.xml b/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-seda-binding-beans.xml
new file mode 100644
index 000000000..2121ccd99
--- /dev/null
+++ b/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-seda-binding-beans.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+ fooSedaName
+ 55
+ 3
+ Always
+ 1000
+ true
+ false
+
+
+
+
+
diff --git a/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-timer-binding-beans.xml b/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-timer-binding-beans.xml
new file mode 100644
index 000000000..08bf60e04
--- /dev/null
+++ b/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-timer-binding-beans.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+ fooTimer
+ 2011-01-01T12:00:00
+ yyyy-MM-dd'T'HH:mm:ss
+ 555
+ 100
+ true
+ false
+
+
+
+
+
diff --git a/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-vm-binding-beans.xml b/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-vm-binding-beans.xml
new file mode 100644
index 000000000..e0398a183
--- /dev/null
+++ b/components/camel/camel-core/src/test/resources/org/switchyard/component/camel/config/model/v1/switchyard-vm-binding-beans.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+ vmTransporter
+ 3
+
+
+
+
+
diff --git a/components/camel/camel-cxf/pom.xml b/components/camel/camel-cxf/pom.xml
new file mode 100644
index 000000000..216dc111f
--- /dev/null
+++ b/components/camel/camel-cxf/pom.xml
@@ -0,0 +1,61 @@
+
+
+
+ 4.0.0
+
+ org.switchyard.components
+ switchyard-component-camel-parent
+ 2.1.0-SNAPSHOT
+
+ switchyard-component-camel-cxf
+ bundle
+ SwitchYard: Camel Component :: CXF Binding
+ http://switchyard.org
+
+
+ org.switchyard.component.camel.cxf.*
+
+
+ org.apache.camel.component.cxf,
+ org.switchyard.config.model;org.switchyard.*;${switchyard.osgi.import.switchyard.version},
+ *
+
+
+
+
+ org.switchyard.components
+ switchyard-component-common-camel
+
+
+ org.switchyard.components
+ switchyard-component-camel-switchyard
+
+
+ org.apache.camel
+ camel-core
+ compile
+
+
+ org.apache.camel
+ camel-cxf
+ compile
+
+
+ org.switchyard.components
+ switchyard-component-camel-test
+ test
+
+
+
diff --git a/components/camel/camel-cxf/src/main/java/org/switchyard/component/camel/cxf/deploy/CamelCxfComponent.java b/components/camel/camel-cxf/src/main/java/org/switchyard/component/camel/cxf/deploy/CamelCxfComponent.java
new file mode 100644
index 000000000..e210bc355
--- /dev/null
+++ b/components/camel/camel-cxf/src/main/java/org/switchyard/component/camel/cxf/deploy/CamelCxfComponent.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2014 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.cxf.deploy;
+
+import org.switchyard.component.camel.common.deploy.BaseBindingComponent;
+import org.switchyard.component.camel.cxf.model.v2.V2CamelCxfBindingModel;
+
+/**
+ * Camel cxf component.
+ */
+public class CamelCxfComponent extends BaseBindingComponent {
+
+ /**
+ * Creates new component.
+ */
+ public CamelCxfComponent() {
+ super("CamelCxfComponent", V2CamelCxfBindingModel.CXF);
+ }
+
+}
+
diff --git a/components/camel/camel-cxf/src/main/java/org/switchyard/component/camel/cxf/model/CamelCxfBindingModel.java b/components/camel/camel-cxf/src/main/java/org/switchyard/component/camel/cxf/model/CamelCxfBindingModel.java
new file mode 100644
index 000000000..23811bb4f
--- /dev/null
+++ b/components/camel/camel-cxf/src/main/java/org/switchyard/component/camel/cxf/model/CamelCxfBindingModel.java
@@ -0,0 +1,310 @@
+/*
+ * Copyright 2014 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.cxf.model;
+
+import java.net.URI;
+
+import org.switchyard.component.camel.common.model.CamelBindingModel;
+
+/**
+ * Camel CXF binding model.
+ */
+public interface CamelCxfBindingModel extends CamelBindingModel {
+ /**
+ * Gets cxfURI.
+ * @return cxfURI
+ */
+ URI getCxfURI();
+
+ /**
+ * Sets cxfURI.
+ * @param cxfURI cxfURI
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setCxfURI(URI cxfURI);
+
+ /**
+ * Gets wsdlURL.
+ * @return wsdlURL
+ */
+ String getWsdlURL();
+
+ /**
+ * Sets wsdlURL.
+ * @param wsdlURL wsdlURL
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setWsdlURL(String wsdlURL);
+
+ /**
+ * Gets serviceClass.
+ * @return serviceClass
+ */
+ String getServiceClass();
+
+ /**
+ * Sets serviceClass.
+ * @param serviceClass serviceClass
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setServiceClass(String serviceClass);
+
+ /**
+ * Gets serviceName.
+ * @return serviceName
+ */
+ String getServiceName();
+
+ /**
+ * Sets serviceName.
+ * @param serviceName serviceName
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setServiceName(String serviceName);
+
+ /**
+ * Gets portName.
+ * @return portName
+ */
+ String getPortName();
+
+ /**
+ * Sets portName.
+ * @param portName portName
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setPortName(String portName);
+
+ /**
+ * Gets dataFormat.
+ * @return dataFormat
+ */
+ String getDataFormat();
+
+ /**
+ * Sets dataFormat.
+ * @param dataFormat dataFormat
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setDataFormat(String dataFormat);
+
+ /**
+ * Gets relayHeaders.
+ * @return relayHeaders
+ */
+ Boolean isRelayHeaders();
+
+ /**
+ * Sets relayHeaders.
+ * @param relayHeaders relayHeaders
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setRelayHeaders(Boolean relayHeaders);
+
+ /**
+ * Gets wrapped.
+ * @return wrapped
+ */
+ Boolean isWrapped();
+
+ /**
+ * Sets wrapped.
+ * @param wrapped wrapped
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setWrapped(Boolean wrapped);
+
+ /**
+ * Gets wrappedStyle.
+ * @return wrappedStyle
+ */
+ Boolean isWrappedStyle();
+
+ /**
+ * Sets wrappedStyle.
+ * @param wrappedStyle wrappedStyle
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setWrappedStyle(Boolean wrappedStyle);
+
+ /**
+ * Gets setDefaultBus.
+ * @return setDefaultBus
+ */
+ Boolean isSetDefaultBus();
+
+ /**
+ * Sets setDefaultBus.
+ * @param setDefaultBus setDefaultBus
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setSetDefaultBus(Boolean setDefaultBus);
+
+ /**
+ * Gets bus.
+ * @return bus
+ */
+ String getBus();
+
+ /**
+ * Sets bus.
+ * @param bus bus
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setBus(String bus);
+
+ /**
+ * Gets cxfBinding.
+ * @return cxfBinding
+ */
+ String getCxfBinding();
+
+ /**
+ * Sets cxfBinding.
+ * @param cxfBinding cxfBinding
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setCxfBinding(String cxfBinding);
+
+ /**
+ * Gets headerFilterStrategy.
+ * @return headerFilterStrategy
+ */
+ String getHeaderFilterStrategy();
+
+ /**
+ * Sets headerFilterStrategy.
+ * @param headerFilterStrategy headerFilterStrategy
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setHeaderFilterStrategy(String headerFilterStrategy);
+
+ /**
+ * Gets loggingFeatureEnabled.
+ * @return loggingFeatureEnabled
+ */
+ Boolean isLoggingFeatureEnabled();
+
+ /**
+ * Sets loggingFeatureEnabled.
+ * @param loggingFeatureEnabled loggingFeatureEnabled
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setLoggingFeatureEnabled(Boolean loggingFeatureEnabled);
+
+ /**
+ * Gets defaultOperationName.
+ * @return defaultOperationName
+ */
+ String getDefaultOperationName();
+
+ /**
+ * Sets defaultOperationName.
+ * @param defaultOperationName defaultOperationName
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setDefaultOperationName(String defaultOperationName);
+
+ /**
+ * Gets defaultOperationNamespace.
+ * @return defaultOperationNamespace
+ */
+ String getDefaultOperationNamespace();
+
+ /**
+ * Sets defaultOperationNamespace.
+ * @param defaultOperationNamespace defaultOperationNamespace
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setDefaultOperationNamespace(String defaultOperationNamespace);
+
+ /**
+ * Gets synchronous.
+ * @return synchronous
+ */
+ Boolean isSynchronous();
+
+ /**
+ * Sets synchronous.
+ * @param synchronous synchronous
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setSynchronous(Boolean synchronous);
+
+ /**
+ * Gets publishedEndpointUrl.
+ * @return publishedEndpointUrl
+ */
+ String getPublishedEndpointUrl();
+
+ /**
+ * Sets publishedEndpointUrl.
+ * @param publishedEndpointUrl publishedEndpointUrl
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setPublishedEndpointUrl(String publishedEndpointUrl);
+
+ /**
+ * Gets allowStreaming.
+ * @return allowStreaming
+ */
+ Boolean isAllowStreaming();
+
+ /**
+ * Sets allowStreaming.
+ * @param allowStreaming allowStreaming
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setAllowStreaming(Boolean allowStreaming);
+
+ /**
+ * Gets skipFaultLogging.
+ * @return skipFaultLogging
+ */
+ Boolean isSkipFaultLogging();
+
+ /**
+ * Sets skipFaultLogging.
+ * @param skipFaultLogging skipFaultLogging
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setSkipFaultLogging(Boolean skipFaultLogging);
+
+ /**
+ * Gets username.
+ * @return username
+ */
+ String getUsername();
+
+ /**
+ * Sets username.
+ * @param username username
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setUsername(String username);
+
+ /**
+ * Gets password.
+ * @return password
+ */
+ String getPassword();
+
+ /**
+ * Sets password.
+ * @param password password
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelCxfBindingModel setPassword(String password);
+
+}
diff --git a/components/camel/camel-cxf/src/main/java/org/switchyard/component/camel/cxf/model/CamelCxfNamespace.java b/components/camel/camel-cxf/src/main/java/org/switchyard/component/camel/cxf/model/CamelCxfNamespace.java
new file mode 100644
index 000000000..633a1624e
--- /dev/null
+++ b/components/camel/camel-cxf/src/main/java/org/switchyard/component/camel/cxf/model/CamelCxfNamespace.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2014 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.cxf.model;
+
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Namespace;
+
+/**
+ * A Camel Cxf config model namespace.
+ */
+public enum CamelCxfNamespace implements Namespace {
+
+ /** The 2.0 namespace. */
+ V_2_0("2.0"),
+ /** The default namespace. */
+ DEFAULT(null);
+
+ private final Util _util;
+
+ /**
+ * Constructs a new CamelCxfNamespace with the specified version.
+ * @param version the specified version, or null to discover the default
+ */
+ CamelCxfNamespace(String version) {
+ _util = new Util(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String section() {
+ return _util.section();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String version() {
+ return _util.version();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean versionMatches(Namespace namespace) {
+ return _util.versionMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String uri() {
+ return _util.uri();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean uriMatches(Namespace namespace) {
+ return _util.uriMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDefault() {
+ return this == DEFAULT || uriMatches(DEFAULT);
+ }
+
+ /**
+ * Gets the CamelCxfNamespace for the specified uri, or null if no matching uris are found.
+ * @param uri the uri
+ * @return the CamelCxfNamespace
+ */
+ public static CamelCxfNamespace fromUri(String uri) {
+ return Util.fromUri(CamelCxfNamespace.class, uri);
+ }
+
+ @SuppressWarnings("serial")
+ private static final class Util extends Namespace.Util {
+ // static final since we only want to do the somewhat expensive work of instantiating this once!
+ private static final Descriptor DESCRIPTOR = new Descriptor(CamelCxfNamespace.class);
+ private Util(String version) {
+ super(DESCRIPTOR, "urn:switchyard-component-camel-cxf:config", version);
+ }
+ }
+
+}
diff --git a/components/camel/camel-cxf/src/main/java/org/switchyard/component/camel/cxf/model/v2/V2CamelCxfBindingModel.java b/components/camel/camel-cxf/src/main/java/org/switchyard/component/camel/cxf/model/v2/V2CamelCxfBindingModel.java
new file mode 100644
index 000000000..21bf2f472
--- /dev/null
+++ b/components/camel/camel-cxf/src/main/java/org/switchyard/component/camel/cxf/model/v2/V2CamelCxfBindingModel.java
@@ -0,0 +1,361 @@
+/*
+ * Copyright 2014 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.cxf.model.v2;
+
+import java.net.URI;
+import java.util.List;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelBindingModel;
+import org.switchyard.component.camel.cxf.model.CamelCxfBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * V2Camel CXF binding model.
+ */
+public class V2CamelCxfBindingModel extends V1BaseCamelBindingModel
+ implements CamelCxfBindingModel {
+
+ /**
+ * The name of this binding type ("binding.cxf").
+ */
+ public static final String CXF = "cxf";
+
+ private static final String CXFURI = "cxfURI";
+ private static final String WSDLURL = "wsdlURL";
+ private static final String SERVICECLASS = "serviceClass";
+ private static final String SERVICENAME = "serviceName";
+ private static final String PORTNAME = "portName";
+ private static final String DATAFORMAT = "dataFormat";
+ private static final String RELAYHEADERS = "relayHeaders";
+ private static final String WRAPPED = "wrapped";
+ private static final String WRAPPEDSTYLE = "wrappedStyle";
+ private static final String SETDEFAULTBUS = "setDefaultBus";
+ private static final String BUS = "bus";
+ private static final String CXFBINDING = "cxfBinding";
+ private static final String HEADERFILTERSTRATEGY = "headerFilterStrategy";
+ private static final String LOGGINGFEATUREENABLED = "loggingFeatureEnabled";
+ private static final String DEFAULTOPERATIONNAME = "defaultOperationName";
+ private static final String DEFAULTOPERATIONNAMESPACE = "defaultOperationNamespace";
+ private static final String SYNCHRONOUS = "synchronous";
+ private static final String PUBLISHEDENDPOINTURL = "publishedEndpointUrl";
+ private static final String ALLOWSTREAMING = "allowStreaming";
+ private static final String SKIPFAULTLOGGING = "skipFaultLogging";
+ private static final String USERNAME = "username";
+ private static final String PASSWORD = "password";
+
+ /**
+ * Create a new CxfBindingModel.
+ * @param namespace namespace
+ */
+ public V2CamelCxfBindingModel(String namespace) {
+ super(CXF, namespace);
+
+ setModelChildrenOrder(CXFURI, WSDLURL, SERVICECLASS, SERVICENAME, PORTNAME, DATAFORMAT, RELAYHEADERS, WRAPPED, WRAPPEDSTYLE, SETDEFAULTBUS, BUS, CXFBINDING, HEADERFILTERSTRATEGY, LOGGINGFEATUREENABLED, DEFAULTOPERATIONNAME, DEFAULTOPERATIONNAMESPACE, SYNCHRONOUS, PUBLISHEDENDPOINTURL, ALLOWSTREAMING, SKIPFAULTLOGGING, USERNAME, PASSWORD);
+ }
+
+ /**
+ * Create a CxfBindingModel from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V2CamelCxfBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ @Override
+ public URI getCxfURI() {
+ String uriStr = getConfig(CXFURI);
+ if (uriStr != null) {
+ return URI.create(uriStr);
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setCxfURI(URI cxfURI) {
+ setConfig(CXFURI, cxfURI);
+ return this;
+ }
+
+
+ @Override
+ public String getWsdlURL() {
+ return getConfig(WSDLURL);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setWsdlURL(String wsdlURL) {
+ setConfig(WSDLURL, wsdlURL);
+ return this;
+ }
+
+
+ @Override
+ public String getServiceClass() {
+ return getConfig(SERVICECLASS);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setServiceClass(String serviceClass) {
+ setConfig(SERVICECLASS, serviceClass);
+ return this;
+ }
+
+
+ @Override
+ public String getServiceName() {
+ return getConfig(SERVICENAME);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setServiceName(String serviceName) {
+ setConfig(SERVICENAME, serviceName);
+ return this;
+ }
+
+
+ @Override
+ public String getPortName() {
+ return getConfig(PORTNAME);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setPortName(String portName) {
+ setConfig(PORTNAME, portName);
+ return this;
+ }
+
+
+ @Override
+ public String getDataFormat() {
+ return getConfig(DATAFORMAT);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setDataFormat(String dataFormat) {
+ setConfig(DATAFORMAT, dataFormat);
+ return this;
+ }
+
+
+ @Override
+ public Boolean isRelayHeaders() {
+ return getBooleanConfig(RELAYHEADERS);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setRelayHeaders(Boolean relayHeaders) {
+ setConfig(RELAYHEADERS, relayHeaders);
+ return this;
+ }
+
+
+ @Override
+ public Boolean isWrapped() {
+ return getBooleanConfig(WRAPPED);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setWrapped(Boolean wrapped) {
+ setConfig(WRAPPED, wrapped);
+ return this;
+ }
+
+
+ @Override
+ public Boolean isWrappedStyle() {
+ return getBooleanConfig(WRAPPEDSTYLE);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setWrappedStyle(Boolean wrappedStyle) {
+ setConfig(WRAPPEDSTYLE, wrappedStyle);
+ return this;
+ }
+
+
+ @Override
+ public Boolean isSetDefaultBus() {
+ return getBooleanConfig(SETDEFAULTBUS);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setSetDefaultBus(Boolean setDefaultBus) {
+ setConfig(SETDEFAULTBUS, setDefaultBus);
+ return this;
+ }
+
+
+ @Override
+ public String getBus() {
+ return getConfig(BUS);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setBus(String bus) {
+ setConfig(BUS, bus);
+ return this;
+ }
+
+
+ @Override
+ public String getCxfBinding() {
+ return getConfig(CXFBINDING);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setCxfBinding(String cxfBinding) {
+ setConfig(CXFBINDING, cxfBinding);
+ return this;
+ }
+
+
+ @Override
+ public String getHeaderFilterStrategy() {
+ return getConfig(HEADERFILTERSTRATEGY);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setHeaderFilterStrategy(String headerFilterStrategy) {
+ setConfig(HEADERFILTERSTRATEGY, headerFilterStrategy);
+ return this;
+ }
+
+
+ @Override
+ public Boolean isLoggingFeatureEnabled() {
+ return getBooleanConfig(LOGGINGFEATUREENABLED);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setLoggingFeatureEnabled(Boolean loggingFeatureEnabled) {
+ setConfig(LOGGINGFEATUREENABLED, loggingFeatureEnabled);
+ return this;
+ }
+
+
+ @Override
+ public String getDefaultOperationName() {
+ return getConfig(DEFAULTOPERATIONNAME);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setDefaultOperationName(String defaultOperationName) {
+ setConfig(DEFAULTOPERATIONNAME, defaultOperationName);
+ return this;
+ }
+
+
+ @Override
+ public String getDefaultOperationNamespace() {
+ return getConfig(DEFAULTOPERATIONNAMESPACE);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setDefaultOperationNamespace(String defaultOperationNamespace) {
+ setConfig(DEFAULTOPERATIONNAMESPACE, defaultOperationNamespace);
+ return this;
+ }
+
+
+ @Override
+ public Boolean isSynchronous() {
+ return getBooleanConfig(SYNCHRONOUS);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setSynchronous(Boolean synchronous) {
+ setConfig(SYNCHRONOUS, synchronous);
+ return this;
+ }
+
+
+ @Override
+ public String getPublishedEndpointUrl() {
+ return getConfig(PUBLISHEDENDPOINTURL);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setPublishedEndpointUrl(String publishedEndpointUrl) {
+ setConfig(PUBLISHEDENDPOINTURL, publishedEndpointUrl);
+ return this;
+ }
+
+
+ @Override
+ public Boolean isAllowStreaming() {
+ return getBooleanConfig(ALLOWSTREAMING);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setAllowStreaming(Boolean allowStreaming) {
+ setConfig(ALLOWSTREAMING, allowStreaming);
+ return this;
+ }
+
+
+ @Override
+ public Boolean isSkipFaultLogging() {
+ return getBooleanConfig(SKIPFAULTLOGGING);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setSkipFaultLogging(Boolean skipFaultLogging) {
+ setConfig(SKIPFAULTLOGGING, skipFaultLogging);
+ return this;
+ }
+
+
+ @Override
+ public String getUsername() {
+ return getConfig(USERNAME);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setUsername(String username) {
+ setConfig(USERNAME, username);
+ return this;
+ }
+
+
+ @Override
+ public String getPassword() {
+ return getConfig(PASSWORD);
+ }
+
+ @Override
+ public V2CamelCxfBindingModel setPassword(String password) {
+ setConfig(PASSWORD, password);
+ return this;
+ }
+
+
+ @Override
+ public URI getComponentURI() {
+ Configuration modelConfiguration = getModelConfiguration();
+ List children = modelConfiguration.getChildren();
+
+ String baseUri = CXF + "://" + getCxfURI();
+
+ QueryString queryStr = new QueryString();
+ traverseConfiguration(children, queryStr, CXFURI);
+
+ return URI.create(baseUri + queryStr.toString());
+ }
+
+}
diff --git a/components/camel/camel-cxf/src/main/java/org/switchyard/component/camel/cxf/model/v2/V2CamelCxfModelMarshaller.java b/components/camel/camel-cxf/src/main/java/org/switchyard/component/camel/cxf/model/v2/V2CamelCxfModelMarshaller.java
new file mode 100644
index 000000000..eb0e45728
--- /dev/null
+++ b/components/camel/camel-cxf/src/main/java/org/switchyard/component/camel/cxf/model/v2/V2CamelCxfModelMarshaller.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2014 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.cxf.model.v2;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelMarshaller;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+import org.switchyard.config.model.composite.BindingModel;
+
+/**
+ * V2 Cxf model marshaller.
+ */
+public class V2CamelCxfModelMarshaller extends V1BaseCamelMarshaller {
+
+ private static final String BINDING_CXF = BindingModel.BINDING + '.' + V2CamelCxfBindingModel.CXF;
+
+ /**
+ * Creates new marshaller.
+ *
+ * @param desc Descriptor
+ */
+ public V2CamelCxfModelMarshaller(Descriptor desc) {
+ super(desc);
+ }
+
+ /**
+ * Reads in the Configuration, looking for various knowledge models.
+ * If not found, it falls back to the super class (V1BaseCamelMarshaller).
+ *
+ * @param config the Configuration
+ * @return the Model
+ */
+ @Override
+ public Model read(Configuration config) {
+ String name = config.getName();
+ Descriptor desc = getDescriptor();
+ if (BINDING_CXF.equals(name)) {
+ return new V2CamelCxfBindingModel(config, desc);
+ }
+ return super.read(config);
+ }
+
+}
diff --git a/components/camel/camel-cxf/src/main/resources/META-INF/services/org.switchyard.deploy.Component b/components/camel/camel-cxf/src/main/resources/META-INF/services/org.switchyard.deploy.Component
new file mode 100644
index 000000000..02d6485d6
--- /dev/null
+++ b/components/camel/camel-cxf/src/main/resources/META-INF/services/org.switchyard.deploy.Component
@@ -0,0 +1 @@
+org.switchyard.component.camel.cxf.deploy.CamelCxfComponent
diff --git a/components/camel/camel-cxf/src/main/resources/org/switchyard/component/camel/cxf/model/v2/camel-cxf_2_0.xsd b/components/camel/camel-cxf/src/main/resources/org/switchyard/component/camel/cxf/model/v2/camel-cxf_2_0.xsd
new file mode 100644
index 000000000..07a45fb22
--- /dev/null
+++ b/components/camel/camel-cxf/src/main/resources/org/switchyard/component/camel/cxf/model/v2/camel-cxf_2_0.xsd
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-cxf/src/main/resources/org/switchyard/config/model/descriptor.properties b/components/camel/camel-cxf/src/main/resources/org/switchyard/config/model/descriptor.properties
new file mode 100644
index 000000000..0cbcb524f
--- /dev/null
+++ b/components/camel/camel-cxf/src/main/resources/org/switchyard/config/model/descriptor.properties
@@ -0,0 +1,18 @@
+# Copyright 2014 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+
+camel_cxf_2_0.section=urn:switchyard-component-camel-cxf:config
+camel_cxf_2_0.version=2.0
+camel_cxf_2_0.namespace=urn:switchyard-component-camel-cxf:config:2.0
+camel_cxf_2_0.schema=camel-cxf_2_0.xsd
+camel_cxf_2_0.location=/org/switchyard/component/camel/cxf/model/v2/
+camel_cxf_2_0.marshaller=org.switchyard.component.camel.cxf.model.v2.V2CamelCxfModelMarshaller
diff --git a/components/camel/camel-cxf/src/test/java/org/switchyard/component/camel/cxf/HelloWorldService.java b/components/camel/camel-cxf/src/test/java/org/switchyard/component/camel/cxf/HelloWorldService.java
new file mode 100644
index 000000000..2bfb58dc6
--- /dev/null
+++ b/components/camel/camel-cxf/src/test/java/org/switchyard/component/camel/cxf/HelloWorldService.java
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2014, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.cxf;
+
+
+/**
+ * HelloWorldService Interface.
+ */
+public interface HelloWorldService {
+
+ /**
+ * Interface method.
+ * @param input the input
+ * @return the response
+ */
+ public String sayHello(String input);
+
+}
diff --git a/components/camel/camel-cxf/src/test/java/org/switchyard/component/camel/cxf/model/v2/V2CamelCxfBindingModelTest.java b/components/camel/camel-cxf/src/test/java/org/switchyard/component/camel/cxf/model/v2/V2CamelCxfBindingModelTest.java
new file mode 100644
index 000000000..96bc76337
--- /dev/null
+++ b/components/camel/camel-cxf/src/test/java/org/switchyard/component/camel/cxf/model/v2/V2CamelCxfBindingModelTest.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2014 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.cxf.model.v2;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URI;
+import java.text.ParseException;
+import java.util.Collections;
+
+import org.apache.camel.component.cxf.CxfEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.cxf.model.CamelCxfNamespace;
+
+/**
+ * Test of cxf binding model.
+ */
+public class V2CamelCxfBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v2/switchyard-cxf-binding.xml";
+
+ private static final String CAMEL_URI =
+ "cxf://http://localhost:8080/testWS?wsdlURL=http://localhost:8080/testWS?wsdl&serviceClass=org.switchyard.component.camel.cxf.HelloWorldService&serviceName={org.foo}Service&portName={org.foo}Port&dataFormat=PAYLOAD&wrapped=true&wrappedStyle=true&setDefaultBus=true&loggingFeatureEnabled=false&defaultOperationName=opName&defaultOperationNamespace=org.foo&synchronous=true&publishedEndpointUrl=scheme://form&allowStreaming=false&skipFaultLogging=false&properties.foo=bar";
+ private static final URI CXFURI = URI.create("http://localhost:8080/testWS");
+ private static final String WSDLURL = "http://localhost:8080/testWS?wsdl";
+ private static final String SERVICECLASS = "org.switchyard.component.camel.cxf.HelloWorldService";
+ private static final String SERVICENAME = "{org.foo}Service";
+ private static final String PORTNAME = "{org.foo}Port";
+ private static final String DATAFORMAT = "PAYLOAD";
+ private static final Boolean WRAPPED = true;
+ private static final Boolean WRAPPEDSTYLE = true;
+ private static final Boolean SETDEFAULTBUS = true;
+ private static final Boolean LOGGINGFEATUREENABLED = false;
+ private static final String DEFAULTOPERATIONNAME = "opName";
+ private static final String DEFAULTOPERATIONNAMESPACE = "org.foo";
+ private static final Boolean SYNCHRONOUS = true;
+ private static final String PUBLISHEDENDPOINTURL = "scheme://form";
+ private static final Boolean ALLOWSTREAMING = false;
+ private static final Boolean SKIPFAULTLOGGING = false;
+
+ public V2CamelCxfBindingModelTest() throws ParseException {
+ super(CxfEndpoint.class, CAMEL_XML);
+ }
+
+ @Override
+ protected void createModelAssertions(V2CamelCxfBindingModel model) {
+ assertEquals(CXFURI, model. getCxfURI());
+ assertEquals(WSDLURL, model. getWsdlURL());
+ assertEquals(SERVICECLASS, model. getServiceClass());
+ assertEquals(SERVICENAME, model. getServiceName());
+ assertEquals(PORTNAME, model. getPortName());
+ assertEquals(DATAFORMAT, model. getDataFormat());
+ assertEquals(WRAPPED, model. isWrapped());
+ assertEquals(WRAPPEDSTYLE, model. isWrappedStyle());
+ assertEquals(SETDEFAULTBUS, model. isSetDefaultBus());
+ assertEquals(LOGGINGFEATUREENABLED, model. isLoggingFeatureEnabled());
+ assertEquals(DEFAULTOPERATIONNAME, model. getDefaultOperationName());
+ assertEquals(DEFAULTOPERATIONNAMESPACE, model. getDefaultOperationNamespace());
+ assertEquals(SYNCHRONOUS, model. isSynchronous());
+ assertEquals(PUBLISHEDENDPOINTURL, model. getPublishedEndpointUrl());
+ assertEquals(ALLOWSTREAMING, model. isAllowStreaming());
+ assertEquals(SKIPFAULTLOGGING, model. isSkipFaultLogging());
+ }
+
+ @Override
+ protected V2CamelCxfBindingModel createTestModel() {
+ V2CamelCxfBindingModel abm = new V2CamelCxfBindingModel(CamelCxfNamespace.V_2_0.uri());
+ abm.setAdditionalUriParameters(createAdditionalUriParametersModel(CamelCxfNamespace.V_2_0.uri(), Collections.singletonMap("properties.foo", "bar")));
+ abm
+ .setCxfURI(CXFURI)
+ .setWsdlURL(WSDLURL)
+ .setServiceClass(SERVICECLASS)
+ .setServiceName(SERVICENAME)
+ .setPortName(PORTNAME)
+ .setDataFormat(DATAFORMAT)
+ .setWrapped(WRAPPED)
+ .setWrappedStyle(WRAPPEDSTYLE)
+ .setSetDefaultBus(SETDEFAULTBUS)
+ .setLoggingFeatureEnabled(LOGGINGFEATUREENABLED)
+ .setDefaultOperationName(DEFAULTOPERATIONNAME)
+ .setDefaultOperationNamespace(DEFAULTOPERATIONNAMESPACE)
+ .setSynchronous(SYNCHRONOUS)
+ .setPublishedEndpointUrl(PUBLISHEDENDPOINTURL)
+ .setAllowStreaming(ALLOWSTREAMING)
+ .setSkipFaultLogging(SKIPFAULTLOGGING);
+ return abm;
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-cxf/src/test/resources/v2/switchyard-cxf-binding.xml b/components/camel/camel-cxf/src/test/resources/v2/switchyard-cxf-binding.xml
new file mode 100644
index 000000000..740c7aa27
--- /dev/null
+++ b/components/camel/camel-cxf/src/test/resources/v2/switchyard-cxf-binding.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+ http://localhost:8080/testWS
+ http://localhost:8080/testWS?wsdl
+ org.switchyard.component.camel.cxf.HelloWorldService
+ {org.foo}Service
+ {org.foo}Port
+ PAYLOAD
+ true
+ true
+ true
+ false
+ opName
+ org.foo
+ true
+ scheme://form
+ false
+ false
+
+
+
+
diff --git a/components/camel/camel-file/pom.xml b/components/camel/camel-file/pom.xml
new file mode 100644
index 000000000..4307642af
--- /dev/null
+++ b/components/camel/camel-file/pom.xml
@@ -0,0 +1,55 @@
+
+
+
+ 4.0.0
+
+ org.switchyard.components
+ switchyard-component-camel-parent
+ 2.1.0-SNAPSHOT
+
+ switchyard-component-camel-file
+ bundle
+ SwitchYard: Camel Component :: File Binding
+ http://switchyard.org
+
+
+ org.switchyard.component.camel.file.*
+
+
+ org.switchyard.config.model;org.switchyard.*;${switchyard.osgi.import.switchyard.version},
+ *
+
+
+
+
+ org.switchyard.components
+ switchyard-component-common-camel
+
+
+ org.switchyard.components
+ switchyard-component-camel-switchyard
+
+
+ org.apache.camel
+ camel-core
+ compile
+
+
+ org.switchyard.components
+ switchyard-component-camel-test
+ test
+
+
+
diff --git a/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/deploy/CamelFileComponent.java b/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/deploy/CamelFileComponent.java
new file mode 100644
index 000000000..19932e158
--- /dev/null
+++ b/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/deploy/CamelFileComponent.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.file.deploy;
+
+import org.switchyard.component.camel.common.deploy.BaseBindingComponent;
+import org.switchyard.component.camel.file.model.v1.V1CamelFileBindingModel;
+
+/**
+ * Camel file component.
+ */
+public class CamelFileComponent extends BaseBindingComponent {
+
+ /**
+ * Creates new component.
+ */
+ public CamelFileComponent() {
+ super("CamelFileComponent", V1CamelFileBindingModel.FILE);
+ }
+
+}
diff --git a/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/CamelFileBindingModel.java b/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/CamelFileBindingModel.java
new file mode 100644
index 000000000..84af2d4aa
--- /dev/null
+++ b/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/CamelFileBindingModel.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.file.model;
+
+import org.switchyard.component.camel.common.model.file.GenericFileBindingModel;
+import org.switchyard.component.camel.common.model.file.GenericFileProducerBindingModel;
+
+/**
+ * Represents the configuration settings for Camel File binding.
+ */
+public interface CamelFileBindingModel extends GenericFileBindingModel {
+
+ /**
+ * The consumer's configurations.
+ * @return an instance of the camel file consumer binding model
+ */
+ CamelFileConsumerBindingModel getConsumer();
+
+ /**
+ * Specify the consumer binding model.
+ * @param consumer the consumer binding model
+ * @return a reference to this Camel File binding model
+ */
+ GenericFileBindingModel setConsumer(CamelFileConsumerBindingModel consumer);
+
+ /**
+ * The producers's configurations.
+ * @return an instance of the camel file producer binding model
+ */
+ GenericFileProducerBindingModel getProducer();
+
+ /**
+ * Specify the producer binding model.
+ * @param producer the producer binding model
+ * @return a reference to this Camel File binding model
+ */
+ GenericFileBindingModel setProducer(GenericFileProducerBindingModel producer);
+
+}
diff --git a/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/CamelFileConsumerBindingModel.java b/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/CamelFileConsumerBindingModel.java
new file mode 100644
index 000000000..7d6d041d0
--- /dev/null
+++ b/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/CamelFileConsumerBindingModel.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.file.model;
+
+import org.switchyard.component.camel.common.model.file.GenericFileConsumerBindingModel;
+
+/**
+ * Represents the configuration settings for a File Consumer binding in Camel.
+ *
+ * @author Mario Antollini
+ */
+public interface CamelFileConsumerBindingModel extends GenericFileConsumerBindingModel {
+
+}
diff --git a/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/CamelFileNamespace.java b/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/CamelFileNamespace.java
new file mode 100644
index 000000000..a1956c577
--- /dev/null
+++ b/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/CamelFileNamespace.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.file.model;
+
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Namespace;
+
+/**
+ * A Camel File config model namespace.
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+public enum CamelFileNamespace implements Namespace {
+
+ /** The 1.0 namespace. */
+ V_1_0("1.0"),
+ /** The 1.1 namespace. */
+ V_1_1("1.1"),
+ /** The 2.0 namespace. */
+ V_2_0("2.0"),
+ /** The default namespace. */
+ DEFAULT(null);
+
+ private final Util _util;
+
+ /**
+ * Constructs a new CamelFileNamespace with the specified version.
+ * @param version the specified version, or null to discover the default
+ */
+ CamelFileNamespace(String version) {
+ _util = new Util(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String section() {
+ return _util.section();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String version() {
+ return _util.version();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean versionMatches(Namespace namespace) {
+ return _util.versionMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String uri() {
+ return _util.uri();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean uriMatches(Namespace namespace) {
+ return _util.uriMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDefault() {
+ return this == DEFAULT || uriMatches(DEFAULT);
+ }
+
+ /**
+ * Gets the CamelFileNamespace for the specified uri, or null if no matching uris are found.
+ * @param uri the uri
+ * @return the CamelFileNamespace
+ */
+ public static CamelFileNamespace fromUri(String uri) {
+ return Util.fromUri(CamelFileNamespace.class, uri);
+ }
+
+ @SuppressWarnings("serial")
+ private static final class Util extends Namespace.Util {
+ // static final since we only want to do the somewhat expensive work of instantiating this once!
+ private static final Descriptor DESCRIPTOR = new Descriptor(CamelFileNamespace.class);
+ private Util(String version) {
+ super(DESCRIPTOR, "urn:switchyard-component-camel-file:config", version);
+ }
+ }
+
+}
diff --git a/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/CamelFileProducerBindingModel.java b/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/CamelFileProducerBindingModel.java
new file mode 100644
index 000000000..20426f7cb
--- /dev/null
+++ b/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/CamelFileProducerBindingModel.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.file.model;
+
+import org.switchyard.component.camel.common.model.file.GenericFileProducerBindingModel;
+
+/**
+ * Represents the configuration settings for a File Producer binding in Camel.
+ *
+ * @author Mario Antollini
+ */
+public interface CamelFileProducerBindingModel extends GenericFileProducerBindingModel {
+
+}
diff --git a/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/v1/V1CamelFileBindingModel.java b/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/v1/V1CamelFileBindingModel.java
new file mode 100644
index 000000000..333959961
--- /dev/null
+++ b/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/v1/V1CamelFileBindingModel.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.file.model.v1;
+
+import java.net.URI;
+import java.util.List;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.common.model.file.GenericFileProducerBindingModel;
+import org.switchyard.component.camel.common.model.file.v1.V1GenericFileBindingModel;
+import org.switchyard.component.camel.common.model.file.v1.V1GenericFileProducerBindingModel;
+import org.switchyard.component.camel.common.model.v1.V1CamelScheduledPollConsumer;
+import org.switchyard.component.camel.file.model.CamelFileBindingModel;
+import org.switchyard.component.camel.file.model.CamelFileConsumerBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+/**
+ * A binding for Camel's file component.
+ *
+ * @author Daniel Bevenius
+ *
+ */
+public class V1CamelFileBindingModel extends V1GenericFileBindingModel
+ implements CamelFileBindingModel {
+
+ /**
+ * The name of this binding type ("binding.file").
+ */
+ public static final String FILE = "file";
+
+ /**
+ * In charge of parsing out consumer options
+ */
+ private CamelFileConsumerBindingModel _consume;
+
+ /**
+ * In charge of parsing out producer options
+ */
+ private GenericFileProducerBindingModel _produce;
+
+ /**
+ * Create a new V1CamelFileBindingModel.
+ * @param namespace namespace
+ */
+ public V1CamelFileBindingModel(String namespace) {
+ super(FILE, namespace);
+
+ setModelChildrenOrder(CONSUME, PRODUCE);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param config
+ * The switchyard configuration instance.
+ * @param desc
+ * The switchyard descriptor instance.
+ */
+ public V1CamelFileBindingModel(final Configuration config, final Descriptor desc) {
+ super(config, desc);
+ }
+
+ @Override
+ public CamelFileConsumerBindingModel getConsumer() {
+ if (_consume == null) {
+ Configuration config = getModelConfiguration().getFirstChild(CONSUME);
+ _consume = new V1CamelFileConsumerBindingModel(config, getModelDescriptor());
+ }
+ return _consume;
+ }
+
+ @Override
+ public V1CamelFileBindingModel setConsumer(CamelFileConsumerBindingModel consumer) {
+ Configuration config = getModelConfiguration().getFirstChild(CONSUME);
+ if (config != null) {
+ // set an existing config value
+ getModelConfiguration().removeChildren(CONSUME);
+ getModelConfiguration().addChild(
+ ((V1CamelScheduledPollConsumer) consumer)
+ .getModelConfiguration());
+ } else {
+ setChildModel((V1CamelScheduledPollConsumer) consumer);
+ }
+ _consume = consumer;
+ return this;
+ }
+
+ @Override
+ public GenericFileProducerBindingModel getProducer() {
+ if (_produce == null) {
+ Configuration config = getModelConfiguration().getFirstChild(PRODUCE);
+ _produce = new V1CamelFileProducerBindingModel(config, getModelDescriptor());
+ }
+ return _produce;
+ }
+
+ @Override
+ public V1CamelFileBindingModel setProducer(GenericFileProducerBindingModel producer) {
+ Configuration config = getModelConfiguration().getFirstChild(PRODUCE);
+ if (config != null) {
+ // set an existing config value
+ getModelConfiguration().removeChildren(PRODUCE);
+ getModelConfiguration().addChild(
+ ((V1GenericFileProducerBindingModel) producer)
+ .getModelConfiguration());
+ } else {
+ setChildModel((V1GenericFileProducerBindingModel) producer);
+ }
+ _produce = producer;
+ return this;
+ }
+
+ @Override
+ public URI getComponentURI() {
+ Configuration modelConfiguration = getModelConfiguration();
+ List children = modelConfiguration.getChildren();
+
+ QueryString queryString = new QueryString();
+ traverseConfiguration(children, queryString, DIRECTORY);
+
+ URI newURI = URI.create(FILE + "://" + getDirectory() + queryString);
+ return newURI;
+ }
+
+}
diff --git a/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/v1/V1CamelFileConsumerBindingModel.java b/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/v1/V1CamelFileConsumerBindingModel.java
new file mode 100644
index 000000000..5589af621
--- /dev/null
+++ b/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/v1/V1CamelFileConsumerBindingModel.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.file.model.v1;
+
+import org.switchyard.component.camel.common.model.file.v1.V1GenericFileConsumerBindingModel;
+import org.switchyard.component.camel.file.model.CamelFileConsumerBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * A binding for Camel's file component, for consumer configs.
+ *
+ * @author Mario Antollini
+ */
+public class V1CamelFileConsumerBindingModel extends V1GenericFileConsumerBindingModel
+ implements CamelFileConsumerBindingModel {
+
+ /**
+ * Create a new V1CamelFileConsumerBindingModel.
+ * @param namespace namespace
+ */
+ public V1CamelFileConsumerBindingModel(String namespace) {
+ super(namespace, V1CamelFileBindingModel.CONSUME);
+ }
+
+ /**
+ * Create a V1CamelFileConsumerBindingModel from the specified configuration
+ * and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V1CamelFileConsumerBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+}
diff --git a/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/v1/V1CamelFileModelMarshaller.java b/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/v1/V1CamelFileModelMarshaller.java
new file mode 100644
index 000000000..c02767318
--- /dev/null
+++ b/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/v1/V1CamelFileModelMarshaller.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.file.model.v1;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelMarshaller;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+import org.switchyard.config.model.composite.BindingModel;
+
+/**
+ * File model marshaller.
+ */
+public class V1CamelFileModelMarshaller extends V1BaseCamelMarshaller {
+
+ private static final String BINDING_FILE = BindingModel.BINDING + '.' + V1CamelFileBindingModel.FILE;
+
+ /**
+ * Creates new marshaller.
+ *
+ * @param desc Descriptor.
+ */
+ public V1CamelFileModelMarshaller(Descriptor desc) {
+ super(desc);
+ }
+
+ /**
+ * Reads in the Configuration, looking for various knowledge models.
+ * If not found, it falls back to the super class (V1BaseCamelMarshaller).
+ *
+ * @param config the Configuration
+ * @return the Model
+ */
+ @Override
+ public Model read(Configuration config) {
+ String name = config.getName();
+ Descriptor desc = getDescriptor();
+ if (BINDING_FILE.equals(name)) {
+ return new V1CamelFileBindingModel(config, desc);
+ }
+ // V1CamelFileConsumerBindingModel and V1CamelFileProducerBindingModel get created by V1CamelFileBindingModel
+ return super.read(config);
+ }
+
+}
diff --git a/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/v1/V1CamelFileProducerBindingModel.java b/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/v1/V1CamelFileProducerBindingModel.java
new file mode 100644
index 000000000..75fd8f487
--- /dev/null
+++ b/components/camel/camel-file/src/main/java/org/switchyard/component/camel/file/model/v1/V1CamelFileProducerBindingModel.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.file.model.v1;
+
+import org.switchyard.component.camel.common.model.file.v1.V1GenericFileProducerBindingModel;
+import org.switchyard.component.camel.file.model.CamelFileProducerBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * A binding for Camel's file component, for producer configurations.
+ *
+ * @author Mario Antollini
+ */
+public class V1CamelFileProducerBindingModel extends V1GenericFileProducerBindingModel
+ implements CamelFileProducerBindingModel {
+
+ /**
+ * Create a new V1CamelFileProducerBindingModel.
+ * @param namespace namespace
+ */
+ public V1CamelFileProducerBindingModel(String namespace) {
+ super(namespace, V1CamelFileBindingModel.PRODUCE);
+ }
+
+ /**
+ * Create a V1CamelFileProducerBindingModel from the specified configuration
+ * and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V1CamelFileProducerBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+}
diff --git a/components/camel/camel-file/src/main/resources/META-INF/services/org.switchyard.deploy.Component b/components/camel/camel-file/src/main/resources/META-INF/services/org.switchyard.deploy.Component
new file mode 100644
index 000000000..3fe7e4212
--- /dev/null
+++ b/components/camel/camel-file/src/main/resources/META-INF/services/org.switchyard.deploy.Component
@@ -0,0 +1 @@
+org.switchyard.component.camel.file.deploy.CamelFileComponent
\ No newline at end of file
diff --git a/components/camel/camel-file/src/main/resources/org/switchyard/component/camel/file/model/v1/camel-file_1_0.xsd b/components/camel/camel-file/src/main/resources/org/switchyard/component/camel/file/model/v1/camel-file_1_0.xsd
new file mode 100644
index 000000000..67add3763
--- /dev/null
+++ b/components/camel/camel-file/src/main/resources/org/switchyard/component/camel/file/model/v1/camel-file_1_0.xsd
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-file/src/main/resources/org/switchyard/component/camel/file/model/v1/camel-file_1_1.xsd b/components/camel/camel-file/src/main/resources/org/switchyard/component/camel/file/model/v1/camel-file_1_1.xsd
new file mode 100644
index 000000000..0bc851bd1
--- /dev/null
+++ b/components/camel/camel-file/src/main/resources/org/switchyard/component/camel/file/model/v1/camel-file_1_1.xsd
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-file/src/main/resources/org/switchyard/component/camel/file/model/v2/camel-file_2_0.xsd b/components/camel/camel-file/src/main/resources/org/switchyard/component/camel/file/model/v2/camel-file_2_0.xsd
new file mode 100644
index 000000000..a3a808463
--- /dev/null
+++ b/components/camel/camel-file/src/main/resources/org/switchyard/component/camel/file/model/v2/camel-file_2_0.xsd
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-file/src/main/resources/org/switchyard/config/model/descriptor.properties b/components/camel/camel-file/src/main/resources/org/switchyard/config/model/descriptor.properties
new file mode 100644
index 000000000..68f045530
--- /dev/null
+++ b/components/camel/camel-file/src/main/resources/org/switchyard/config/model/descriptor.properties
@@ -0,0 +1,32 @@
+# Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+
+camel_file_1_0.section=urn:switchyard-component-camel-file:config
+camel_file_1_0.version=1.0
+camel_file_1_0.namespace=urn:switchyard-component-camel-file:config:1.0
+camel_file_1_0.schema=camel-file_1_0.xsd
+camel_file_1_0.location=/org/switchyard/component/camel/file/model/v1/
+camel_file_1_0.marshaller=org.switchyard.component.camel.file.model.v1.V1CamelFileModelMarshaller
+
+camel_file_1_1.section=urn:switchyard-component-camel-file:config
+camel_file_1_1.version=1.1
+camel_file_1_1.namespace=urn:switchyard-component-camel-file:config:1.1
+camel_file_1_1.schema=camel-file_1_1.xsd
+camel_file_1_1.location=/org/switchyard/component/camel/file/model/v1/
+camel_file_1_1.marshaller=org.switchyard.component.camel.file.model.v1.V1CamelFileModelMarshaller
+
+camel_file_2_0.section=urn:switchyard-component-camel-file:config
+camel_file_2_0.version=2.0
+camel_file_2_0.namespace=urn:switchyard-component-camel-file:config:2.0
+camel_file_2_0.schema=camel-file_2_0.xsd
+camel_file_2_0.location=/org/switchyard/component/camel/file/model/v2/
+camel_file_2_0.marshaller=org.switchyard.component.camel.file.model.v1.V1CamelFileModelMarshaller
diff --git a/components/camel/camel-file/src/test/java/org/switchyard/component/camel/file/v1/V1CamelFileBindingModelTest.java b/components/camel/camel-file/src/test/java/org/switchyard/component/camel/file/v1/V1CamelFileBindingModelTest.java
new file mode 100644
index 000000000..e759fd428
--- /dev/null
+++ b/components/camel/camel-file/src/test/java/org/switchyard/component/camel/file/v1/V1CamelFileBindingModelTest.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.file.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.camel.component.file.FileEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.file.model.CamelFileNamespace;
+import org.switchyard.component.camel.file.model.v1.V1CamelFileBindingModel;
+
+/**
+ * Test for {@link V1CamelBindingModel}.
+ *
+ * @author Daniel Bevenius
+ */
+public class V1CamelFileBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-file-binding-beans.xml";
+ private static final String DIRECTORY = "/input/directory";
+ private static final Boolean AUTO_CREATE = false;
+ private static final Integer BUFFER_SIZE = 2048;
+ private static final String FILE_NAME = "fname";
+ private static final String CHARSET = "cp1250";
+ private static final Boolean FLATTEN = true;
+ private static final String CAMEL_URI = "file:///input/directory?autoCreate=false&" +
+ "bufferSize=2048&charset=cp1250&fileName=fname&flatten=true";
+
+ public V1CamelFileBindingModelTest() {
+ super(FileEndpoint.class, CAMEL_XML);
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelFileBindingModel model) {
+ assertEquals(DIRECTORY, model.getDirectory());
+ assertEquals(AUTO_CREATE, model.isAutoCreate());
+ assertEquals(BUFFER_SIZE, model.getBufferSize());
+ assertEquals(FILE_NAME, model.getFileName());
+ assertEquals(FLATTEN, model.isFlatten());
+ assertEquals(CHARSET, model.getCharset());
+ }
+
+ @Override
+ protected V1CamelFileBindingModel createTestModel() {
+ return (V1CamelFileBindingModel) new V1CamelFileBindingModel(CamelFileNamespace.V_1_0.uri())
+ .setDirectory(DIRECTORY)
+ .setAutoCreate(AUTO_CREATE)
+ .setBufferSize(BUFFER_SIZE)
+ .setFileName(FILE_NAME)
+ .setFlatten(FLATTEN)
+ .setCharset(CHARSET);
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-file/src/test/java/org/switchyard/component/camel/file/v1/V1CamelFileConsumerBindingModelTest.java b/components/camel/camel-file/src/test/java/org/switchyard/component/camel/file/v1/V1CamelFileConsumerBindingModelTest.java
new file mode 100644
index 000000000..7e9d2d04f
--- /dev/null
+++ b/components/camel/camel-file/src/test/java/org/switchyard/component/camel/file/v1/V1CamelFileConsumerBindingModelTest.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.file.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.camel.component.file.FileEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.file.model.CamelFileConsumerBindingModel;
+import org.switchyard.component.camel.file.model.CamelFileNamespace;
+import org.switchyard.component.camel.file.model.v1.V1CamelFileBindingModel;
+import org.switchyard.component.camel.file.model.v1.V1CamelFileConsumerBindingModel;
+
+/**
+ * Test for {@link V1CamelBindingModel}.
+ *
+ * @author Mario Antollini
+ */
+public class V1CamelFileConsumerBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-file-binding-consumer-beans.xml";
+
+ private static final String DIRECTORY = "/input/directory";
+ private static final Integer INITIAL_DELAY = 500;
+ private static final Integer DELAY = 1000;
+ private static final Integer MAX_MESSAGES_PER_POLL = 100;
+ private static final Boolean DELETE = Boolean.FALSE;
+ private static final Boolean RECURSIVE = true;
+ private static final Boolean NOOP = false;
+ private static final String PRE_MOVE = ".inProgress";
+ private static final String MOVE = ".done";
+ private static final String MOVE_FAILED = ".failed";
+ private static final String INCLUDE = "*.csv";
+ private static final String EXCLUDE = "*.xml";
+ private static final Boolean IDEMPOTENT = true;
+ private static final String SORT_BY = "file:name";
+ private static final String READ_LOCK = "fileLock";
+ private static final Long READ_LOCK_TIMEOUT = 10L;
+ private static final Integer READ_LOCK_CHECK_INTERVAL = new Integer(1000);
+ private static final Boolean STARTING_DIRECTORY_MUST_EXIST = false;
+ private static final Boolean DIRECTORY_MUST_EXIST = Boolean.TRUE;
+ private static final String DONE_FILE_NAME = "done";
+ private static final String CAMEL_URI = "file:///input/directory?delay=1000&initialDelay=500&maxMessagesPerPoll=100&delete=false&" +
+ "recursive=true&noop=false&preMove=.inProgress&move=.done&moveFailed=.failed&" +
+ "include=*.csv&exclude=*.xml&idempotent=true&sortBy=file:name&" +
+ "readLock=fileLock&readLockTimeout=10&readLockCheckInterval=1000&" +
+ "startingDirectoryMustExist=false&directoryMustExist=true&doneFileName=done";
+
+ public V1CamelFileConsumerBindingModelTest() {
+ super(FileEndpoint.class, CAMEL_XML);
+ }
+
+ @Override
+ protected V1CamelFileBindingModel createTestModel() {
+ V1CamelFileBindingModel fileModel = new V1CamelFileBindingModel(CamelFileNamespace.V_1_0.uri());
+ fileModel.setDirectory(DIRECTORY);
+
+ V1CamelFileConsumerBindingModel model = (V1CamelFileConsumerBindingModel) new V1CamelFileConsumerBindingModel(CamelFileNamespace.V_1_0.uri())
+ .setInitialDelay(INITIAL_DELAY)
+ .setDelay(DELAY);
+ model.setMaxMessagesPerPoll(MAX_MESSAGES_PER_POLL);
+ model.setDelete(DELETE)
+ .setRecursive(RECURSIVE)
+ .setNoop(NOOP)
+ .setPreMove(PRE_MOVE)
+ .setMove(MOVE)
+ .setMoveFailed(MOVE_FAILED)
+ .setInclude(INCLUDE)
+ .setExclude(EXCLUDE)
+ .setIdempotent(IDEMPOTENT)
+ .setSortBy(SORT_BY)
+ .setReadLock(READ_LOCK)
+ .setReadLockTimeout(READ_LOCK_TIMEOUT)
+ .setReadLockCheckInterval(READ_LOCK_CHECK_INTERVAL)
+ .setStartingDirectoryMustExist(STARTING_DIRECTORY_MUST_EXIST)
+ .setDirectoryMustExist(DIRECTORY_MUST_EXIST)
+ .setDoneFileName(DONE_FILE_NAME);
+ return fileModel.setConsumer(model);
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelFileBindingModel model) {
+ CamelFileConsumerBindingModel consumer = model.getConsumer();
+
+ assertEquals(INITIAL_DELAY, consumer.getInitialDelay());
+ assertEquals(DELAY, consumer.getDelay());
+ assertEquals(MAX_MESSAGES_PER_POLL, consumer.getMaxMessagesPerPoll());
+ assertEquals(RECURSIVE, consumer.isRecursive());
+ assertEquals(DELETE, consumer.isDelete());
+ assertEquals(NOOP, consumer.isNoop());
+ assertEquals(PRE_MOVE, consumer.getPreMove());
+ assertEquals(MOVE, consumer.getMove());
+ assertEquals(MOVE_FAILED, consumer.getMoveFailed());
+ assertEquals(INCLUDE, consumer.getInclude());
+ assertEquals(EXCLUDE, consumer.getExclude());
+ assertEquals(IDEMPOTENT, consumer.isIdempotent());
+ assertEquals(SORT_BY, consumer.getSortBy());
+ assertEquals(READ_LOCK, consumer.getReadLock());
+ assertEquals(READ_LOCK_TIMEOUT, consumer.getReadLockTimeout());
+ assertEquals(READ_LOCK_CHECK_INTERVAL, consumer.getReadLockCheckInterval());
+ assertEquals(STARTING_DIRECTORY_MUST_EXIST, consumer.isStartingDirectoryMustExist());
+ assertEquals(DIRECTORY_MUST_EXIST, consumer.isDirectoryMustExist());
+ assertEquals(DONE_FILE_NAME, consumer.getDoneFileName());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-file/src/test/java/org/switchyard/component/camel/file/v1/V1CamelFileProducerBindingModelTest.java b/components/camel/camel-file/src/test/java/org/switchyard/component/camel/file/v1/V1CamelFileProducerBindingModelTest.java
new file mode 100644
index 000000000..676d58578
--- /dev/null
+++ b/components/camel/camel-file/src/test/java/org/switchyard/component/camel/file/v1/V1CamelFileProducerBindingModelTest.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.file.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.camel.component.file.FileEndpoint;
+import org.switchyard.component.camel.common.model.file.GenericFileProducerBindingModel;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelReferenceBindingModelTest;
+import org.switchyard.component.camel.file.model.CamelFileNamespace;
+import org.switchyard.component.camel.file.model.v1.V1CamelFileBindingModel;
+import org.switchyard.component.camel.file.model.v1.V1CamelFileProducerBindingModel;
+
+/**
+ * Test for {@link V1CamelBindingModel}.
+ *
+ * @author Mario Antollini
+ */
+public class V1CamelFileProducerBindingModelTest extends V1BaseCamelReferenceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-file-binding-producer-beans.xml";
+
+ private static final String DIRECTORY = "/input/directory";
+ private static final Boolean AUTO_CREATE = Boolean.FALSE;
+ private static final String FILE_EXIST = "Override";
+ private static final String TEMP_PREFIX = "prefix_";
+ private static final Boolean KEEP_LAST_MODIFIED = Boolean.FALSE;
+ private static final Boolean EAGER_DELETE_TARGET_FLE = Boolean.TRUE;
+ private static final String DONE_FILENAME = "processed";
+ private static final String CAMEL_URI =
+ "file:///input/directory?autoCreate=false&fileExist=Override" +
+ "&tempPrefix=prefix_&keepLastModified=false" +
+ "&eagerDeleteTargetFile=true&doneFileName=processed";
+
+ public V1CamelFileProducerBindingModelTest() {
+ super(FileEndpoint.class, CAMEL_XML);
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelFileBindingModel model) {
+ GenericFileProducerBindingModel producer = model.getProducer();
+ assertEquals(FILE_EXIST, producer.getFileExist());
+ assertEquals(TEMP_PREFIX, producer.getTempPrefix());
+ assertEquals(KEEP_LAST_MODIFIED, producer.isKeepLastModified());
+ assertEquals(EAGER_DELETE_TARGET_FLE, producer.isEagerDeleteTargetFile());
+ assertEquals(DONE_FILENAME, producer.getDoneFileName());
+ }
+
+ @Override
+ protected V1CamelFileBindingModel createTestModel() {
+ V1CamelFileBindingModel fileModel = (V1CamelFileBindingModel) new V1CamelFileBindingModel(CamelFileNamespace.V_1_0.uri())
+ .setDirectory(DIRECTORY)
+ .setAutoCreate(AUTO_CREATE);
+
+ GenericFileProducerBindingModel producer = new V1CamelFileProducerBindingModel(CamelFileNamespace.V_1_0.uri())
+ .setFileExist(FILE_EXIST)
+ .setTempPrefix(TEMP_PREFIX)
+ .setKeepLastModified(KEEP_LAST_MODIFIED)
+ .setEagerDeleteTargetFile(EAGER_DELETE_TARGET_FLE)
+ .setDoneFileName(DONE_FILENAME);
+ return fileModel.setProducer(producer);
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-file/src/test/resources/v1/switchyard-file-binding-beans.xml b/components/camel/camel-file/src/test/resources/v1/switchyard-file-binding-beans.xml
new file mode 100644
index 000000000..1d81a8d52
--- /dev/null
+++ b/components/camel/camel-file/src/test/resources/v1/switchyard-file-binding-beans.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+ /input/directory
+ false
+ 2048
+ fname
+ true
+ cp1250
+
+
+
+
+
diff --git a/components/camel/camel-file/src/test/resources/v1/switchyard-file-binding-consumer-beans.xml b/components/camel/camel-file/src/test/resources/v1/switchyard-file-binding-consumer-beans.xml
new file mode 100644
index 000000000..311e51f1a
--- /dev/null
+++ b/components/camel/camel-file/src/test/resources/v1/switchyard-file-binding-consumer-beans.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+ /input/directory
+
+ 500
+ 1000
+ 100
+ false
+ true
+ false
+ .inProgress
+ .done
+ .failed
+ *.csv
+ *.xml
+ true
+ file:name
+ fileLock
+ 10
+ 1000
+ false
+ true
+ done
+
+
+
+
+
diff --git a/components/camel/camel-file/src/test/resources/v1/switchyard-file-binding-producer-beans.xml b/components/camel/camel-file/src/test/resources/v1/switchyard-file-binding-producer-beans.xml
new file mode 100644
index 000000000..45a5883c5
--- /dev/null
+++ b/components/camel/camel-file/src/test/resources/v1/switchyard-file-binding-producer-beans.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+ /input/directory
+ false
+
+ Override
+ prefix_
+ false
+ true
+ processed
+
+
+
+
+
+
diff --git a/components/camel/camel-ftp/pom.xml b/components/camel/camel-ftp/pom.xml
new file mode 100644
index 000000000..49ab15973
--- /dev/null
+++ b/components/camel/camel-ftp/pom.xml
@@ -0,0 +1,58 @@
+
+
+
+ 4.0.0
+
+ org.switchyard.components
+ switchyard-component-camel-parent
+ 2.1.0-SNAPSHOT
+
+ switchyard-component-camel-ftp
+ bundle
+ SwitchYard: Camel Component :: FTP Binding
+ http://switchyard.org
+
+
+ org.switchyard.component.camel.ftp.*;
+ org.switchyard.component.camel.ftps.*;
+ org.switchyard.component.camel.sftp.*;
+
+
+ org.apache.camel.component.file.remote,
+ org.switchyard.config.model;org.switchyard.*;${switchyard.osgi.import.switchyard.version},
+ *
+
+
+
+
+ org.switchyard.components
+ switchyard-component-common-camel
+
+
+ org.switchyard.components
+ switchyard-component-camel-switchyard
+
+
+ org.apache.camel
+ camel-ftp
+ compile
+
+
+ org.switchyard.components
+ switchyard-component-camel-test
+ test
+
+
+
diff --git a/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/deploy/CamelFtpComponent.java b/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/deploy/CamelFtpComponent.java
new file mode 100644
index 000000000..4f628402e
--- /dev/null
+++ b/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/deploy/CamelFtpComponent.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.ftp.deploy;
+
+import org.switchyard.component.camel.common.deploy.BaseBindingComponent;
+import org.switchyard.component.camel.ftp.model.v1.V1CamelFtpBindingModel;
+import org.switchyard.component.camel.ftp.model.v1.V1CamelFtpsBindingModel;
+import org.switchyard.component.camel.ftp.model.v1.V1CamelSftpBindingModel;
+
+/**
+ * Ftp/ftps/sftp binding component.
+ */
+public class CamelFtpComponent extends BaseBindingComponent {
+
+ /**
+ * Creates new component.
+ */
+ public CamelFtpComponent() {
+ super("CamelFtpComponent",
+ V1CamelFtpBindingModel.FTP,
+ V1CamelFtpsBindingModel.FTPS,
+ V1CamelSftpBindingModel.SFTP
+ );
+ }
+
+}
diff --git a/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/CamelFtpBindingModel.java b/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/CamelFtpBindingModel.java
new file mode 100644
index 000000000..431e2210a
--- /dev/null
+++ b/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/CamelFtpBindingModel.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.ftp.model;
+
+import org.switchyard.component.camel.common.model.remote.CamelRemoteFileBindingModel;
+
+/**
+ * Ftp endpoint binding.
+ *
+ * @author Lukasz Dywicki
+ */
+public interface CamelFtpBindingModel extends CamelRemoteFileBindingModel {
+
+ /**
+ * Should connection be used in passive mode.
+ *
+ * @return Passive mode.
+ */
+ Boolean isPassiveMode();
+
+ /**
+ * Sets passive mode.
+ *
+ * @param passive Passive mode.
+ * @return a reference to this binding model
+ */
+ CamelRemoteFileBindingModel setPassiveMode(boolean passive);
+
+ /**
+ * Gets timeout parameter.
+ *
+ * @return Timeout (in milliseconds).
+ */
+ Integer getTimeout();
+
+ /**
+ * Sets timeout.
+ *
+ * @param timeout Timeout.
+ * @return a reference to this binding model
+ */
+ CamelRemoteFileBindingModel setTimeout(int timeout);
+
+ /**
+ * Get socket timeout.
+ *
+ * @return Socket timeout (in milliseconds).
+ */
+ Integer getSoTimeout();
+
+ /**
+ * Sets socket timeout.
+ *
+ * @param timeout Timeout (in milliseconds).
+ * @return a reference to this binding model
+ */
+ CamelRemoteFileBindingModel setSoTimeout(int timeout);
+
+ /**
+ * Gets site command.
+ *
+ * @return Site command.
+ */
+ String getSiteCommand();
+
+ /**
+ * Sets site command.
+ *
+ * @param command Site command.
+ * @return a reference to this binding model
+ */
+ CamelRemoteFileBindingModel setSiteCommand(String command);
+
+}
diff --git a/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/CamelFtpNamespace.java b/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/CamelFtpNamespace.java
new file mode 100644
index 000000000..b3a62356a
--- /dev/null
+++ b/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/CamelFtpNamespace.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.ftp.model;
+
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Namespace;
+
+/**
+ * A Camel Ftp config model namespace.
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+public enum CamelFtpNamespace implements Namespace {
+
+ /** The 1.0 namespace. */
+ V_1_0("1.0"),
+ /** The 1.1 namespace. */
+ V_1_1("1.1"),
+ /** The 2.0 namespace. */
+ V_2_0("2.0"),
+ /** The default namespace. */
+ DEFAULT(null);
+
+ private final Util _util;
+
+ /**
+ * Constructs a new CamelFtpNamespace with the specified version.
+ * @param version the specified version, or null to discover the default
+ */
+ CamelFtpNamespace(String version) {
+ _util = new Util(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String section() {
+ return _util.section();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String version() {
+ return _util.version();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean versionMatches(Namespace namespace) {
+ return _util.versionMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String uri() {
+ return _util.uri();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean uriMatches(Namespace namespace) {
+ return _util.uriMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDefault() {
+ return this == DEFAULT || uriMatches(DEFAULT);
+ }
+
+ /**
+ * Gets the CamelFtpNamespace for the specified uri, or null if no matching uris are found.
+ * @param uri the uri
+ * @return the CamelFtpNamespace
+ */
+ public static CamelFtpNamespace fromUri(String uri) {
+ return Util.fromUri(CamelFtpNamespace.class, uri);
+ }
+
+ @SuppressWarnings("serial")
+ private static final class Util extends Namespace.Util {
+ // static final since we only want to do the somewhat expensive work of instantiating this once!
+ private static final Descriptor DESCRIPTOR = new Descriptor(CamelFtpNamespace.class);
+ private Util(String version) {
+ super(DESCRIPTOR, "urn:switchyard-component-camel-ftp:config", version);
+ }
+ }
+
+}
diff --git a/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/CamelFtpsBindingModel.java b/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/CamelFtpsBindingModel.java
new file mode 100644
index 000000000..6c060c0d5
--- /dev/null
+++ b/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/CamelFtpsBindingModel.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.ftp.model;
+
+
+/**
+ * Ftps endpoint binding.
+ *
+ * @author Lukasz Dywicki
+ */
+public interface CamelFtpsBindingModel extends CamelFtpBindingModel {
+
+ /**
+ * Gets security protocol.
+ *
+ * @return Protocol to use.
+ */
+ String getSecurityProtocol();
+
+ /**
+ * Sets the underlying security protocol. The following values are defined:
+ * TLS: Transport Layer Security
+ * SSL: Secure Sockets Layer
+ *
+ * @param protocol Protocol to use.
+ * @return a reference to this binding model
+ */
+ CamelFtpsBindingModel setSecurityProtocol(String protocol);
+
+ /**
+ * Gets security mode.
+ *
+ * @return True if security mode is implicit.
+ */
+ Boolean isImplict();
+
+ /**
+ * Sets the security mode(implicit/explicit). Default is explicit (false).
+ *
+ * @param implicit Implicit flag.
+ * @return a reference to this binding model
+ */
+ CamelFtpsBindingModel setImplict(Boolean implicit);
+
+ /**
+ * Gets buffer size for secure data channel.
+ *
+ * @return Buffer size.
+ */
+ Long getExecPbsz();
+
+ /**
+ * This option specifies the buffer size of the secure data channel. If option useSecureDataChannel
+ * has been enabled and this option has not been explicit set, then value 0 is used.
+ *
+ * @param pbsz Buffer size for secure data channel.
+ * @return a reference to this binding model
+ */
+ CamelFtpsBindingModel setExecPbsz(Long pbsz);
+
+ /**
+ * Gets actual execProt value.
+ *
+ * @return Prot value.
+ */
+ String getExecProt();
+
+ /**
+ * Will by default use option P if secure data channel defaults hasn't been disabled. Possible values are:
+ * C: Clear
+ * S: Safe (SSL protocol only)
+ * E: Confidential (SSL protocol only)
+ * P: Private
+ *
+ * @param prot Prot mode
+ * @return a reference to this binding model
+ */
+ CamelFtpsBindingModel setExecProt(String prot);
+
+ /**
+ * Gets mode of secure channel defaults.
+ *
+ * @return True if defaults for PROT and PBSZ are disabled.
+ */
+ Boolean isDisableSecureDataChannelDefaults();
+
+ /**
+ * Whether or not to disable using default values for execPbsz and execProt when using secure data transfer.
+ * You can set this option to true if you want to be in absolute full control what the options execPbsz and execProt
+ * should be used.
+ *
+ * @param disableSecureDataChannelDefaults Flag to disable defaults.
+ * @return a reference to this binding model
+ */
+ CamelFtpsBindingModel setDisableSecureDataChannelDefaults(Boolean disableSecureDataChannelDefaults);
+
+}
diff --git a/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/CamelSftpBindingModel.java b/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/CamelSftpBindingModel.java
new file mode 100644
index 000000000..bbfe73fb7
--- /dev/null
+++ b/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/CamelSftpBindingModel.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.ftp.model;
+
+import org.switchyard.component.camel.common.model.remote.CamelRemoteFileBindingModel;
+
+/**
+ * Sftp endpoint binding.
+ *
+ * @author Lukasz Dywicki
+ */
+public interface CamelSftpBindingModel extends CamelRemoteFileBindingModel {
+
+ /**
+ * The known hosts file.
+ *
+ * @return File used to host key signature verification.
+ */
+ String getKnownHostsFile();
+
+ /**
+ * Sets the known_hosts file, so that the SFTP endpoint can do host key verification.
+ *
+ * @param knownHostsFile File with known hosts.
+ * @return a reference to this binding model
+ */
+ CamelSftpBindingModel setKnownHostsFile(String knownHostsFile);
+
+ /**
+ * Endpoint private key used for authorization.
+ *
+ * @return Private key file.
+ */
+ String getPrivateKeyFile();
+
+ /**
+ * Set the private key file to that the SFTP endpoint can do private key verification.
+ *
+ * @param privateKeyFile Private key file.
+ * @return a reference to this binding model
+ */
+ CamelSftpBindingModel setPrivateKeyFile(String privateKeyFile);
+
+ /**
+ * Passphrase used for private key.
+ *
+ * @return Private key passphrase.
+ */
+ String getPrivateKeyFilePassphrase();
+
+ /**
+ * Set the private key file passphrase to that the SFTP endpoint can do private key verification.
+ *
+ * @param passphrase Passphrase for key file.
+ * @return a reference to this binding model
+ */
+ CamelSftpBindingModel setPrivateKeyFilePassphrase(String passphrase);
+
+}
diff --git a/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/v1/V1CamelFtpBindingModel.java b/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/v1/V1CamelFtpBindingModel.java
new file mode 100644
index 000000000..2a91e79ce
--- /dev/null
+++ b/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/v1/V1CamelFtpBindingModel.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.ftp.model.v1;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.common.model.remote.v1.V1CamelRemoteFileBindingModel;
+import org.switchyard.component.camel.ftp.model.CamelFtpBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * Implementation of ftp configuration binding.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V1CamelFtpBindingModel extends V1CamelRemoteFileBindingModel implements
+ CamelFtpBindingModel {
+
+ /**
+ * Ftp endpoint prefix.
+ */
+ public static final String FTP = "ftp";
+
+ /**
+ * Name of 'passiveMode' element.
+ */
+ protected static final String PASSIVE_MODE = "passiveMode";
+
+ /**
+ * Name of 'timeout' element.
+ */
+ protected static final String TIMEOUT = "timeout";
+
+ /**
+ * Name of 'soTimeout' element.
+ */
+ protected static final String SO_TIMEOUT = "soTimeout";
+
+ /**
+ * Name of 'siteCommand' element.
+ */
+ protected static final String SITE_COMMAND = "siteCommand";
+
+ /**
+ * Create a CamelFtpBindingModel from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param descriptor The switchyard descriptor instance.
+ */
+ public V1CamelFtpBindingModel(Configuration config, Descriptor descriptor) {
+ super(config, descriptor);
+ }
+
+ /**
+ * Default constructor. Creates CamelFtpBindingModel.
+ * @param namespace namespace
+ */
+ public V1CamelFtpBindingModel(String namespace) {
+ this(FTP, namespace);
+ }
+
+ /**
+ * Creates ftp binding model with different protocol scheme.
+ *
+ * @param protocol Protocol scheme.
+ * @param namespace Namespace of extension.
+ */
+ protected V1CamelFtpBindingModel(String protocol, String namespace) {
+ super(protocol, namespace);
+
+ setModelChildrenOrder(PASSIVE_MODE, TIMEOUT, SO_TIMEOUT, SITE_COMMAND, CONSUME, PRODUCE);
+ }
+
+ @Override
+ public Boolean isPassiveMode() {
+ return getBooleanConfig(PASSIVE_MODE);
+ }
+
+ @Override
+ public V1CamelFtpBindingModel setPassiveMode(boolean passive) {
+ return setConfig(PASSIVE_MODE, passive);
+ }
+
+ @Override
+ public Integer getTimeout() {
+ return getIntegerConfig(TIMEOUT);
+ }
+
+ @Override
+ public V1CamelFtpBindingModel setTimeout(int timeout) {
+ return setConfig(TIMEOUT, timeout);
+ }
+
+ @Override
+ public Integer getSoTimeout() {
+ return getIntegerConfig(SO_TIMEOUT);
+ }
+
+ @Override
+ public V1CamelFtpBindingModel setSoTimeout(int timeout) {
+ return setConfig(SO_TIMEOUT, timeout);
+ }
+
+ @Override
+ public String getSiteCommand() {
+ return getConfig(SITE_COMMAND);
+ }
+
+ @Override
+ public V1CamelFtpBindingModel setSiteCommand(String command) {
+ return setConfig(SITE_COMMAND, command);
+ }
+
+ @Override
+ protected void enrichQueryString(QueryString queryString) {
+ // nothing to do here..
+ }
+
+ @Override
+ protected String getEndpointProtocol() {
+ return FTP;
+ }
+
+}
diff --git a/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/v1/V1CamelFtpModelMarshaller.java b/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/v1/V1CamelFtpModelMarshaller.java
new file mode 100644
index 000000000..21b0d1df9
--- /dev/null
+++ b/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/v1/V1CamelFtpModelMarshaller.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.ftp.model.v1;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelMarshaller;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+import org.switchyard.config.model.composite.BindingModel;
+
+/**
+ * Ftp/ftps/sftp model marshaller.
+ */
+public class V1CamelFtpModelMarshaller extends V1BaseCamelMarshaller {
+
+ private static final String BINDING_FTP = BindingModel.BINDING + '.' + V1CamelFtpBindingModel.FTP;
+ private static final String BINDING_FTPS = BindingModel.BINDING + '.' + V1CamelFtpsBindingModel.FTPS;
+ private static final String BINDING_SFTP = BindingModel.BINDING + '.' + V1CamelSftpBindingModel.SFTP;
+
+ /**
+ * Creates new marshaller.
+ *
+ * @param desc Descriptor
+ */
+ public V1CamelFtpModelMarshaller(Descriptor desc) {
+ super(desc);
+ }
+
+ /**
+ * Reads in the Configuration, looking for various knowledge models.
+ * If not found, it falls back to the super class (V1BaseCamelMarshaller).
+ *
+ * @param config the Configuration
+ * @return the Model
+ */
+ @Override
+ public Model read(Configuration config) {
+ String name = config.getName();
+ Descriptor desc = getDescriptor();
+ if (BINDING_FTP.equals(name)) {
+ return new V1CamelFtpBindingModel(config, desc);
+ } else if (BINDING_FTPS.equals(name)) {
+ return new V1CamelFtpsBindingModel(config, desc);
+ } else if (BINDING_SFTP.equals(name)) {
+ return new V1CamelSftpBindingModel(config, desc);
+ }
+ return super.read(config);
+ }
+
+}
diff --git a/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/v1/V1CamelFtpsBindingModel.java b/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/v1/V1CamelFtpsBindingModel.java
new file mode 100644
index 000000000..c09bbc45b
--- /dev/null
+++ b/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/v1/V1CamelFtpsBindingModel.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.ftp.model.v1;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.ftp.model.CamelFtpsBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * Implementation of ftps configuration binding.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V1CamelFtpsBindingModel extends V1CamelFtpBindingModel implements
+ CamelFtpsBindingModel {
+
+ /**
+ * Ftps endpoint prefix.
+ */
+ public static final String FTPS = "ftps";
+
+ private static final String SECURITY_PROTOCOL = "securityProtocol";
+ private static final String IMPLICT = "isImplicit";
+ private static final String EXEC_PBSZ = "execPbsz";
+ private static final String EXEC_PROT = "execProt";
+ private static final String DISABLE_SECURE_DATA_CHANNEL_DEFAULTS = "disableSecureDataChannelDefaults";
+
+ /**
+ * Create a CamelFtpBindingModel from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param descriptor The switchyard descriptor instance.
+ */
+ public V1CamelFtpsBindingModel(Configuration config, Descriptor descriptor) {
+ super(config, descriptor);
+ }
+
+ /**
+ * Default constructor. Creates CamelFtpBindingModel.
+ * @param namespace namespace
+ */
+ public V1CamelFtpsBindingModel(String namespace) {
+ super(FTPS, namespace);
+
+ setModelChildrenOrder(SECURITY_PROTOCOL, IMPLICT, EXEC_PBSZ, EXEC_PROT, DISABLE_SECURE_DATA_CHANNEL_DEFAULTS);
+ }
+
+ @Override
+ protected String getEndpointProtocol() {
+ return FTPS;
+ }
+
+ @Override
+ public String getSecurityProtocol() {
+ return getConfig(SECURITY_PROTOCOL);
+ }
+
+ @Override
+ public V1CamelFtpsBindingModel setSecurityProtocol(String protocol) {
+ return setConfig(SECURITY_PROTOCOL, protocol);
+ }
+
+ @Override
+ public Boolean isImplict() {
+ return getBooleanConfig(IMPLICT);
+ }
+
+ @Override
+ public V1CamelFtpsBindingModel setImplict(Boolean implict) {
+ return setConfig(IMPLICT, String.valueOf(implict));
+ }
+
+ @Override
+ public Long getExecPbsz() {
+ return getLongConfig(EXEC_PBSZ);
+ }
+
+ @Override
+ public V1CamelFtpsBindingModel setExecPbsz(Long pbsz) {
+ return setConfig(EXEC_PBSZ, String.valueOf(pbsz));
+ }
+
+ @Override
+ public String getExecProt() {
+ return getConfig(EXEC_PROT);
+ }
+
+ @Override
+ public V1CamelFtpsBindingModel setExecProt(String prot) {
+ return setConfig(EXEC_PROT, prot);
+ }
+
+ @Override
+ public Boolean isDisableSecureDataChannelDefaults() {
+ return getBooleanConfig(DISABLE_SECURE_DATA_CHANNEL_DEFAULTS);
+ }
+
+ @Override
+ public V1CamelFtpsBindingModel setDisableSecureDataChannelDefaults(Boolean disableDefaults) {
+ return setConfig(DISABLE_SECURE_DATA_CHANNEL_DEFAULTS, String.valueOf(disableDefaults));
+ }
+
+ @Override
+ protected void enrichQueryString(QueryString queryString) {
+ // nothing to do here..
+ }
+
+}
diff --git a/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/v1/V1CamelSftpBindingModel.java b/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/v1/V1CamelSftpBindingModel.java
new file mode 100644
index 000000000..02664a052
--- /dev/null
+++ b/components/camel/camel-ftp/src/main/java/org/switchyard/component/camel/ftp/model/v1/V1CamelSftpBindingModel.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.ftp.model.v1;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.common.model.remote.v1.V1CamelRemoteFileBindingModel;
+import org.switchyard.component.camel.ftp.model.CamelSftpBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * Sftp protocol binding.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V1CamelSftpBindingModel extends V1CamelRemoteFileBindingModel
+ implements CamelSftpBindingModel {
+
+ /**
+ * Sftp protocol/endpoint scheme.
+ */
+ public static final String SFTP = "sftp";
+
+ private static final String KNOWN_HOSTS_FILE = "knownHostsFile";
+ private static final String PRIVATE_KEY_FILE = "privateKeyFile";
+ private static final String PRIVATE_KEY_FILE_PASSPHRASE = "privateKeyFilePassphrase";
+
+ /**
+ * Create a CamelSftpBindingModel from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param descriptor The switchyard descriptor instance.
+ */
+ public V1CamelSftpBindingModel(Configuration config, Descriptor descriptor) {
+ super(config, descriptor);
+ }
+
+ /**
+ * Create CamelSftpBindingModel.
+ * @param namespace namespace
+ */
+ public V1CamelSftpBindingModel(String namespace) {
+ super(SFTP, namespace);
+
+ setModelChildrenOrder(KNOWN_HOSTS_FILE, PRIVATE_KEY_FILE, PRIVATE_KEY_FILE_PASSPHRASE,
+ PRODUCE, CONSUME);
+ }
+
+ @Override
+ public String getKnownHostsFile() {
+ return getConfig(KNOWN_HOSTS_FILE);
+ }
+
+ @Override
+ public V1CamelSftpBindingModel setKnownHostsFile(String knownHostsFile) {
+ return setConfig(KNOWN_HOSTS_FILE, knownHostsFile);
+ }
+
+ @Override
+ public String getPrivateKeyFile() {
+ return getConfig(PRIVATE_KEY_FILE);
+ }
+
+ @Override
+ public V1CamelSftpBindingModel setPrivateKeyFile(String privateKeyFile) {
+ return setConfig(PRIVATE_KEY_FILE, privateKeyFile);
+ }
+
+ @Override
+ public String getPrivateKeyFilePassphrase() {
+ return getConfig(PRIVATE_KEY_FILE_PASSPHRASE);
+ }
+
+ @Override
+ public V1CamelSftpBindingModel setPrivateKeyFilePassphrase(String passphrase) {
+ return setConfig(PRIVATE_KEY_FILE_PASSPHRASE, passphrase);
+ }
+
+ @Override
+ protected String getEndpointProtocol() {
+ return SFTP;
+ }
+
+ @Override
+ protected void enrichQueryString(QueryString queryString) {
+ // nothing to do there
+ }
+
+}
diff --git a/components/camel/camel-ftp/src/main/resources/META-INF/services/org.switchyard.deploy.Component b/components/camel/camel-ftp/src/main/resources/META-INF/services/org.switchyard.deploy.Component
new file mode 100644
index 000000000..5abd5a11d
--- /dev/null
+++ b/components/camel/camel-ftp/src/main/resources/META-INF/services/org.switchyard.deploy.Component
@@ -0,0 +1 @@
+org.switchyard.component.camel.ftp.deploy.CamelFtpComponent
\ No newline at end of file
diff --git a/components/camel/camel-ftp/src/main/resources/org/switchyard/component/camel/ftp/model/v1/camel-ftp_1_0.xsd b/components/camel/camel-ftp/src/main/resources/org/switchyard/component/camel/ftp/model/v1/camel-ftp_1_0.xsd
new file mode 100644
index 000000000..4a809b07e
--- /dev/null
+++ b/components/camel/camel-ftp/src/main/resources/org/switchyard/component/camel/ftp/model/v1/camel-ftp_1_0.xsd
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-ftp/src/main/resources/org/switchyard/component/camel/ftp/model/v1/camel-ftp_1_1.xsd b/components/camel/camel-ftp/src/main/resources/org/switchyard/component/camel/ftp/model/v1/camel-ftp_1_1.xsd
new file mode 100644
index 000000000..8974a1ae1
--- /dev/null
+++ b/components/camel/camel-ftp/src/main/resources/org/switchyard/component/camel/ftp/model/v1/camel-ftp_1_1.xsd
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-ftp/src/main/resources/org/switchyard/component/camel/ftp/model/v2/camel-ftp_2_0.xsd b/components/camel/camel-ftp/src/main/resources/org/switchyard/component/camel/ftp/model/v2/camel-ftp_2_0.xsd
new file mode 100644
index 000000000..faf59d144
--- /dev/null
+++ b/components/camel/camel-ftp/src/main/resources/org/switchyard/component/camel/ftp/model/v2/camel-ftp_2_0.xsd
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-ftp/src/main/resources/org/switchyard/config/model/descriptor.properties b/components/camel/camel-ftp/src/main/resources/org/switchyard/config/model/descriptor.properties
new file mode 100644
index 000000000..8197be3be
--- /dev/null
+++ b/components/camel/camel-ftp/src/main/resources/org/switchyard/config/model/descriptor.properties
@@ -0,0 +1,32 @@
+# Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+
+camel_ftp_1_0.section=urn:switchyard-component-camel-ftp:config
+camel_ftp_1_0.version=1.0
+camel_ftp_1_0.namespace=urn:switchyard-component-camel-ftp:config:1.0
+camel_ftp_1_0.schema=camel-ftp_1_0.xsd
+camel_ftp_1_0.location=/org/switchyard/component/camel/ftp/model/v1/
+camel_ftp_1_0.marshaller=org.switchyard.component.camel.ftp.model.v1.V1CamelFtpModelMarshaller
+
+camel_ftp_1_1.section=urn:switchyard-component-camel-ftp:config
+camel_ftp_1_1.version=1.1
+camel_ftp_1_1.namespace=urn:switchyard-component-camel-ftp:config:1.1
+camel_ftp_1_1.schema=camel-ftp_1_1.xsd
+camel_ftp_1_1.location=/org/switchyard/component/camel/ftp/model/v1/
+camel_ftp_1_1.marshaller=org.switchyard.component.camel.ftp.model.v1.V1CamelFtpModelMarshaller
+
+camel_ftp_2_0.section=urn:switchyard-component-camel-ftp:config
+camel_ftp_2_0.version=2.0
+camel_ftp_2_0.namespace=urn:switchyard-component-camel-ftp:config:2.0
+camel_ftp_2_0.schema=camel-ftp_2_0.xsd
+camel_ftp_2_0.location=/org/switchyard/component/camel/ftp/model/v2/
+camel_ftp_2_0.marshaller=org.switchyard.component.camel.ftp.model.v1.V1CamelFtpModelMarshaller
diff --git a/components/camel/camel-ftp/src/test/java/org/switchyard/component/camel/ftp/model/v1/V1CamelFtpBindingModelTest.java b/components/camel/camel-ftp/src/test/java/org/switchyard/component/camel/ftp/model/v1/V1CamelFtpBindingModelTest.java
new file mode 100644
index 000000000..d90a23ec2
--- /dev/null
+++ b/components/camel/camel-ftp/src/test/java/org/switchyard/component/camel/ftp/model/v1/V1CamelFtpBindingModelTest.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.ftp.model.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.camel.component.file.remote.FtpEndpoint;
+import org.switchyard.component.camel.common.model.remote.CamelRemoteFileBindingModel.PathSeparator;
+import org.switchyard.component.camel.common.model.remote.v1.V1CamelRemoteFileConsumerBindingModel;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.ftp.model.CamelFtpNamespace;
+
+/**
+ * Test for {@link V1CamelFtpBindingModel}.
+ *
+ * @author Lukasz Dywicki
+ */
+@SuppressWarnings("rawtypes")
+public class V1CamelFtpBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-ftp-binding-beans.xml";
+
+ private static final String DIRECTORY = "test";
+ private static final Boolean AUTO_CREATE = false;
+ private static final String HOST = "localhost";
+ private static final Integer PORT = 203;
+ private static final String USERNAME = "camel";
+ private static final String PASSWORD = "secret";
+ private static final Boolean BINARY = true;
+ private static final Integer CONNECT_TIMEOUT = 10;
+ private static final Boolean DISCONNECT = true;
+ private static final Integer MAXIMUM_RECONNECT_ATTEMPTS = 10;
+ private static final Integer RECONNECT_DELAY = 10;
+ private static final PathSeparator SEPARATOR = PathSeparator.UNIX;
+ private static final Boolean STEPWISE = true;
+ private static final Boolean THROW_EXCEPTION_ON_CONNECT_FAIL = true;
+ private static final Integer TIMEOUT = 10;
+ private static final Integer SO_TIMEOUT = 10;
+ private static final Boolean PASSIVE_MODE = true;
+ private static final String SITE_COMMAND = "PWD";
+ private static final Integer INITIAL_DELAY = 500;
+
+ private static final String CAMEL_URI = "ftp://camel:secret@localhost:203/test?autoCreate=false&binary=true&" +
+ "connectTimeout=10&disconnect=true&maximumReconnectAttempts=10&reconnectDelay=10&" +
+ "separator=UNIX&stepwise=true&throwExceptionOnConnectFailed=true&passiveMode=true&" +
+ "timeout=10&soTimeout=10&siteCommand=PWD&initialDelay=500";
+
+ public V1CamelFtpBindingModelTest() {
+ super(FtpEndpoint.class, CAMEL_XML);
+ }
+
+ @Override
+ protected V1CamelFtpBindingModel createTestModel() {
+ V1CamelFtpBindingModel model = (V1CamelFtpBindingModel) new V1CamelFtpBindingModel(CamelFtpNamespace.V_1_0.uri())
+ .setDirectory(DIRECTORY)
+ .setAutoCreate(AUTO_CREATE);
+ model.setHost(HOST)
+ .setPort(PORT)
+ .setUsername(USERNAME)
+ .setPassword(PASSWORD)
+ .setBinary(BINARY)
+ .setConnectionTimeout(CONNECT_TIMEOUT)
+ .setDisconnect(DISCONNECT)
+ .setMaximumReconnectAttempts(MAXIMUM_RECONNECT_ATTEMPTS)
+ .setReconnectDelay(RECONNECT_DELAY)
+ .setSeparator(SEPARATOR.name())
+ .setStepwise(STEPWISE)
+ .setThrowExceptionOnConnectFailed(THROW_EXCEPTION_ON_CONNECT_FAIL);
+ model.setPassiveMode(PASSIVE_MODE)
+ .setTimeout(TIMEOUT)
+ .setSoTimeout(SO_TIMEOUT)
+ .setSiteCommand(SITE_COMMAND);
+ V1CamelRemoteFileConsumerBindingModel consumer = new V1CamelRemoteFileConsumerBindingModel(CamelFtpNamespace.V_1_0.uri(), V1CamelFtpBindingModel.CONSUME);
+ consumer.setInitialDelay(INITIAL_DELAY);
+ model.setConsumer(consumer);
+ return model;
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelFtpBindingModel model) {
+ assertEquals(PASSIVE_MODE, model.isPassiveMode());
+ assertEquals(TIMEOUT, model.getTimeout());
+ assertEquals(SO_TIMEOUT, model.getSoTimeout());
+ assertEquals(SITE_COMMAND, model.getSiteCommand());
+ assertEquals(DIRECTORY, model.getDirectory());
+ assertEquals(HOST, model.getHost());
+ assertEquals(PORT, model.getPort());
+ assertEquals(USERNAME, model.getUsername());
+ assertEquals(PASSWORD, model.getPassword());
+ assertEquals(BINARY, model.isBinary());
+ assertEquals(CONNECT_TIMEOUT, model.getConnectTimeout());
+ assertEquals(THROW_EXCEPTION_ON_CONNECT_FAIL, model.isThrowExceptionOnConnectFailed());
+ assertEquals(STEPWISE, model.isStepwise());
+ assertEquals(SEPARATOR, model.getSeparator());
+ assertEquals(RECONNECT_DELAY, model.getReconnectDelay());
+ assertEquals(MAXIMUM_RECONNECT_ATTEMPTS, model.getMaximumReconnectAttempts());
+ assertEquals(DISCONNECT, model.getDisconnect());
+ assertEquals(INITIAL_DELAY, model.getConsumer().getInitialDelay());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-ftp/src/test/java/org/switchyard/component/camel/ftp/model/v1/V1CamelFtpsBindingModelTest.java b/components/camel/camel-ftp/src/test/java/org/switchyard/component/camel/ftp/model/v1/V1CamelFtpsBindingModelTest.java
new file mode 100644
index 000000000..6ae8cefc4
--- /dev/null
+++ b/components/camel/camel-ftp/src/test/java/org/switchyard/component/camel/ftp/model/v1/V1CamelFtpsBindingModelTest.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.ftp.model.v1;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.camel.component.file.remote.FtpsEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.ftp.model.CamelFtpNamespace;
+import org.switchyard.component.camel.ftp.model.v1.V1CamelFtpsBindingModel;
+
+/**
+ * Test for {@link V1CamelFtpsBindingModel}.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V1CamelFtpsBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-ftps-binding-beans.xml";
+ private static final String DIRECTORY = "test";
+ private static final String HOST = "localhost";
+ private static final Boolean IMPLICT = false;
+ private static final String CAMEL_URI = "ftps://localhost/test?isImplicit=false";
+
+ public V1CamelFtpsBindingModelTest() {
+ super(FtpsEndpoint.class, CAMEL_XML);
+ }
+
+ @Override
+ protected V1CamelFtpsBindingModel createTestModel() {
+ V1CamelFtpsBindingModel model = (V1CamelFtpsBindingModel) new V1CamelFtpsBindingModel(CamelFtpNamespace.V_1_0.uri())
+ .setDirectory(DIRECTORY)
+ .setHost(HOST);
+
+ return model.setImplict(IMPLICT);
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelFtpsBindingModel model) {
+ assertEquals(DIRECTORY, model.getDirectory());
+ assertEquals(HOST, model.getHost());
+ assertEquals(IMPLICT, model.isImplict());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-ftp/src/test/java/org/switchyard/component/camel/ftp/model/v1/V1CamelSftpBindingModelTest.java b/components/camel/camel-ftp/src/test/java/org/switchyard/component/camel/ftp/model/v1/V1CamelSftpBindingModelTest.java
new file mode 100644
index 000000000..e6e2bca60
--- /dev/null
+++ b/components/camel/camel-ftp/src/test/java/org/switchyard/component/camel/ftp/model/v1/V1CamelSftpBindingModelTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.ftp.model.v1;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+
+import java.util.Collections;
+
+import org.apache.camel.component.file.remote.SftpEndpoint;
+import org.junit.Test;
+import org.switchyard.common.property.PropertyResolver;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.ftp.model.CamelFtpNamespace;
+import org.switchyard.component.camel.ftp.model.v1.V1CamelSftpBindingModel;
+import org.switchyard.config.model.Validation;
+
+/**
+ * Test for {@link V1CamelSftpBindingModel}.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V1CamelSftpBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-sftp-binding-beans.xml";
+
+ private static final String DIRECTORY = "test";
+ private static final String HOST = "localhost";
+ private static final int PORT = 9022;
+ private static final String KNOWN_HOSTS = "known_hosts";
+ private static final String PRIVATE_KEY = "my.key";
+ private static final String PRIVATE_KEY_PASSPHRASE = "test";
+
+ private static final String CAMEL_URI = "sftp://localhost:9022/test?knownHostsFile=known_hosts"
+ + "&privateKeyFile=my.key&privateKeyFilePassphrase=test&maxMessagesPerPoll=5";
+
+ public V1CamelSftpBindingModelTest() {
+ super(SftpEndpoint.class, CAMEL_XML);
+ }
+
+ @Test
+ public void validateCamelBindingModelWithBeanElement() throws Exception {
+ final V1CamelSftpBindingModel bindingModel = getFirstCamelBinding(CAMEL_XML);
+ final Validation validateModel = bindingModel.validateModel();
+
+ assertTrue(validateModel.getMessage(), validateModel.isValid());
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelSftpBindingModel model) {
+ assertEquals(DIRECTORY, model.getDirectory());
+ assertEquals(HOST, model.getHost());
+ assertEquals(KNOWN_HOSTS, model.getKnownHostsFile());
+ assertEquals(PRIVATE_KEY, model.getPrivateKeyFile());
+ assertEquals(PRIVATE_KEY_PASSPHRASE, model.getPrivateKeyFilePassphrase());
+ }
+
+ @Override
+ protected V1CamelSftpBindingModel createTestModel() {
+ V1CamelSftpBindingModel model = (V1CamelSftpBindingModel) new V1CamelSftpBindingModel(CamelFtpNamespace.V_1_1.uri());
+ model.getModelConfiguration().setPropertyResolver(new PropertyResolver() {
+ @Override
+ public Object resolveProperty(String key) {
+ if ("maxMessagesPerPoll".equals(key)) {
+ return 5;
+ }
+ return null;
+ }
+ });
+ model.setAdditionalUriParameters(createAdditionalUriParametersModel(CamelFtpNamespace.V_1_1.uri(), Collections.singletonMap("maxMessagesPerPoll", "${maxMessagesPerPoll}")));
+ model.setDirectory(DIRECTORY)
+ .setHost(HOST)
+ .setPort(PORT);
+
+ return model.setKnownHostsFile(KNOWN_HOSTS)
+ .setPrivateKeyFile(PRIVATE_KEY)
+ .setPrivateKeyFilePassphrase(PRIVATE_KEY_PASSPHRASE);
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+
+}
diff --git a/components/camel/camel-ftp/src/test/resources/v1/switchyard-ftp-binding-beans.xml b/components/camel/camel-ftp/src/test/resources/v1/switchyard-ftp-binding-beans.xml
new file mode 100644
index 000000000..2522e81dd
--- /dev/null
+++ b/components/camel/camel-ftp/src/test/resources/v1/switchyard-ftp-binding-beans.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+ test
+ false
+ localhost
+ 203
+ camel
+ secret
+ true
+ 10
+ true
+ 10
+ 10
+ UNIX
+ true
+ true
+ true
+ 10
+ 10
+ PWD
+
+ 500
+
+
+
+
+
+
diff --git a/components/camel/camel-ftp/src/test/resources/v1/switchyard-ftps-binding-beans.xml b/components/camel/camel-ftp/src/test/resources/v1/switchyard-ftps-binding-beans.xml
new file mode 100644
index 000000000..375874648
--- /dev/null
+++ b/components/camel/camel-ftp/src/test/resources/v1/switchyard-ftps-binding-beans.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+ test
+ localhost
+ false
+
+
+
+
+
diff --git a/components/camel/camel-ftp/src/test/resources/v1/switchyard-sftp-binding-beans.xml b/components/camel/camel-ftp/src/test/resources/v1/switchyard-sftp-binding-beans.xml
new file mode 100644
index 000000000..189fc7415
--- /dev/null
+++ b/components/camel/camel-ftp/src/test/resources/v1/switchyard-sftp-binding-beans.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+ test
+ localhost
+ 9022
+ known_hosts
+ my.key
+ test
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-jms/pom.xml b/components/camel/camel-jms/pom.xml
new file mode 100644
index 000000000..9aeda7d50
--- /dev/null
+++ b/components/camel/camel-jms/pom.xml
@@ -0,0 +1,61 @@
+
+
+
+ 4.0.0
+
+ org.switchyard.components
+ switchyard-component-camel-parent
+ 2.1.0-SNAPSHOT
+
+ switchyard-component-camel-jms
+ bundle
+ SwitchYard: Camel Component :: JMS Binding
+ http://switchyard.org
+
+
+ org.switchyard.component.camel.jms.*
+
+
+ org.apache.camel.component.jms,
+ org.switchyard.config.model;org.switchyard.*;${switchyard.osgi.import.switchyard.version},
+ *
+
+
+
+
+
+ org.switchyard.components
+ switchyard-component-common-camel
+
+
+ org.switchyard.components
+ switchyard-component-camel-switchyard
+
+
+ org.apache.camel
+ camel-jms
+ compile
+
+
+ org.switchyard.components
+ switchyard-component-camel-test
+ test
+
+
+
diff --git a/components/camel/camel-jms/src/main/java/org/switchyard/component/camel/jms/deploy/CamelJmsComponent.java b/components/camel/camel-jms/src/main/java/org/switchyard/component/camel/jms/deploy/CamelJmsComponent.java
new file mode 100644
index 000000000..23833f1a4
--- /dev/null
+++ b/components/camel/camel-jms/src/main/java/org/switchyard/component/camel/jms/deploy/CamelJmsComponent.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jms.deploy;
+
+import org.switchyard.component.camel.common.deploy.BaseBindingComponent;
+import org.switchyard.component.camel.jms.model.v1.V1CamelJmsBindingModel;
+
+/**
+ * Jms binding component.
+ */
+public class CamelJmsComponent extends BaseBindingComponent {
+
+ /**
+ * Creates new component.
+ */
+ public CamelJmsComponent() {
+ super("CamelJmsComponent", V1CamelJmsBindingModel.JMS);
+ }
+
+}
diff --git a/components/camel/camel-jms/src/main/java/org/switchyard/component/camel/jms/model/CamelJmsBindingModel.java b/components/camel/camel-jms/src/main/java/org/switchyard/component/camel/jms/model/CamelJmsBindingModel.java
new file mode 100644
index 000000000..6508d8e3d
--- /dev/null
+++ b/components/camel/camel-jms/src/main/java/org/switchyard/component/camel/jms/model/CamelJmsBindingModel.java
@@ -0,0 +1,396 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jms.model;
+
+import org.switchyard.component.camel.common.model.CamelBindingModel;
+
+/**
+ * Represents the configuration settings for a JMS endpoint in Camel.
+ */
+public interface CamelJmsBindingModel extends CamelBindingModel {
+
+ /**
+ * Get JMS queue name to consume from/produce to.
+ *
+ * @return destination name.
+ */
+ String getQueue();
+
+ /**
+ * Specify the queue name to consume from.
+ *
+ * @param queue Queue name.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setQueue(String queue);
+
+ /**
+ * Get JMS queue name to consume from/produce to.
+ *
+ * @return destination name.
+ */
+ String getTopic();
+
+ /**
+ * Specify the topic name to consume from.
+ *
+ * @param topic Topic name.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setTopic(String topic);
+
+ /**
+ * Connection factory used to consume/produce messages.
+ *
+ * @return Connection factory.
+ */
+ String getConnectionFactory();
+
+ /**
+ * Specify connection factory instance name to use.
+ *
+ * @param connectionFactory Name of bean from camel registry.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setConnectionFactory(String connectionFactory);
+
+ /**
+ * The username for the connection factory.
+ *
+ * @return Username for connection factory.
+ */
+ String getUsername();
+
+ /**
+ * Specify username for connection factory.
+ *
+ * @param username Username.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setUsername(String username);
+
+ /**
+ * The password for the connector factory.
+ *
+ * @return Password used to authorize user.
+ */
+ String getPassword();
+
+ /**
+ * Specify password to use.
+ *
+ * @param password Password.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setPassword(String password);
+
+ /**
+ * Obtain client id.
+ *
+ * @return Client id set for connection.
+ */
+ String getClientId();
+
+ /**
+ * Sets the JMS client ID to use. Note that this value, if specified, must be unique and
+ * can only be used by a single JMS connection instance. It is typically only required
+ * for durable topic subscriptions.
+ *
+ * @param clientId Client id.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setClientId(String clientId);
+
+ /**
+ * The durable subscriber name for specifying durable topic subscriptions.
+ * The clientId option must be configured as well.
+ *
+ * @return Subscription name.
+ */
+ String getDurableSubscriptionName();
+
+ /**
+ * Specify name of subscription created by camel endpoint.
+ *
+ * @param durableSubscriptionName Subscription name.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setDurableSubscriptionName(String durableSubscriptionName);
+
+ /**
+ * Get number of concurrent consumers.
+ *
+ * @return Concurrent consumers count.
+ */
+ Integer getConcurrentConsumers();
+
+ /**
+ * Specifies the default number of concurrent consumers.
+ *
+ * @param concurrentConsumers Number of concurrent consumers
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setConcurrentConsumers(Integer concurrentConsumers);
+
+ /**
+ * Number of maximum consumers.
+ *
+ * @return Maximum number of concurrent consumers.
+ */
+ Integer getMaxConcurrentConsumers();
+
+ /**
+ * Specifies the maximum number of concurrent consumers.
+ *
+ * @param maxConcurrentConsumers Maximum number of consumers to use.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setMaxConcurrentConsumers(Integer maxConcurrentConsumers);
+
+ /**
+ * If true, a producer will behave like a InOnly exchange with the exception that
+ * JMSReplyTo header is sent out and not be suppressed like in the case of InOnly.
+ * Like InOnly the producer will not wait for a reply. A consumer with this flag
+ * will behave like InOnly. This feature can be used to bridge InOut requests to
+ * another queue so that a route on the other queue will send it´s response directly
+ * back to the original JMSReplyTo.
+ *
+ * @return Should reply to be disabled and JMSReplyTo header be ignored.
+ */
+ Boolean isDisableReplyTo();
+
+ /**
+ * Specify behavior for JMSReplyTo header.
+ *
+ * @param disableReplyTo True if reply to should be disabled.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setDisableReplyTo(Boolean disableReplyTo);
+
+ /**
+ * Get the way of handling for quality of service related headers.
+ *
+ * @return True if JMSPriority and JMSDeliveryMode be preserved.
+ */
+ Boolean isPreserveMessageQos();
+
+ /**
+ * Set to true, if you want to send message using the QoS settings specified on the message,
+ * instead of the QoS settings on the JMS endpoint. The following three headers are considered
+ * JMSPriority, JMSDeliveryMode, and JMSExpiration. You can provide all or only some of them.
+ * If not provided, Camel will fall back to use the values from the endpoint instead.
+ * So, when using this option, the headers override the values from the endpoint.
+ * The explicitQosEnabled option, by contrast, will only use options set on the endpoint,
+ * and not values from the message header.
+ *
+ * @param preserveMessageQos Should JMSPriority and JMSDeliveryMode be preserved.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setPreserveMessageQos(Boolean preserveMessageQos);
+
+ /**
+ * Should message be sent in persistent mode?
+ *
+ * @return True if delivery should be persistent, false otherwise.
+ */
+ Boolean isDeliveryPersistent();
+
+ /**
+ * Specifies whether persistent delivery is used by default.
+ *
+ * @param deliveryPersistent Should delivery be persistent.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setDeliveryPersistent(Boolean deliveryPersistent);
+
+ /**
+ * Values greater than 1 specify the message priority when sending
+ * (where 0 is the lowest priority and 9 is the highest).
+ *
+ * @return Priority of message to send.
+ */
+ Integer getPriority();
+
+ /**
+ * Specifies message priority.
+ *
+ * @param priority Message priority.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setPriority(Integer priority);
+
+ /**
+ * Set if the deliveryMode, priority or timeToLive qualities of service should be used
+ * when sending messages. This option is based on Spring's JmsTemplate.
+ * The deliveryMode, priority and timeToLive options are applied to the current endpoint.
+ * This contrasts with the preserveMessageQos option, which operates at message granularity,
+ * reading QoS properties exclusively from the Camel In message headers.
+ *
+ * @param explicitQosEnabled Should QOS be explicitly set?
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setExplicitQosEnabled(Boolean explicitQosEnabled);
+
+ /**
+ * Get the status of QOS for endpoint.
+ *
+ * @return True if delivery should be persistent, false otherwise.
+ */
+ Boolean isExplicitQosEnabled();
+
+ /**
+ * Get name of reply destination.
+ *
+ * @return Reply destination name.
+ */
+ String getReplyTo();
+
+ /**
+ * Provides an explicit ReplyTo destination, which overrides any incoming value
+ * of Message.getJMSReplyTo().
+ *
+ * @param replyTo Name of destination used to send reply.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setReplyTo(String replyTo);
+
+ /**
+ * Get reply to type.
+ *
+ * @return Type of reply destination.
+ */
+ String getReplyToType();
+
+ /**
+ * Allows for explicitly specifying which kind of strategy to use for replyTo queues
+ * when doing request/reply over JMS. Possible values are: Temporary, Shared, or Exclusive.
+ * By default Camel will use temporary queues. However if replyTo has been configured,
+ * then Shared is used by default. This option allows you to use exclusive queues
+ * instead of shared ones.
+ *
+ * @param replyToType Type of reply to destination (Temporary, Shared or Exclusive).
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setReplyToType(String replyToType);
+
+ /**
+ * Producer only: The timeout for waiting for a reply when using the InOut
+ * Exchange Pattern (in milliseconds). The default is 20 seconds.
+ *
+ * @return Request timeout for in out communication.
+ */
+ Integer getRequestTimeout();
+
+ /**
+ * Specify request timeout.
+ *
+ * @param requestTimeout Request timeout.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setRequestTimeout(Integer requestTimeout);
+
+ /**
+ * JMS Selector to use.
+ *
+ * @return Selector for message consumption.
+ */
+ String getSelector();
+
+ /**
+ * Sets the JMS Selector, which is an SQL 92 predicate that is used to filter
+ * messages within the broker. You may have to encode special characters such as = as %3D
+ *
+ * @param selector Message selector.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setSelector(String selector);
+
+ /**
+ * Message time to live.
+ *
+ * @return Time to live.
+ */
+ Integer getTimeToLive();
+
+ /**
+ * Specifies the time-to-live of the message (in milliseconds).
+ *
+ * @param timeToLive Time to live for message.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setTimeToLive(Integer timeToLive);
+
+ /**
+ * Checks if transaction should be used to consume/receive messages.
+ *
+ * @return If JMS session is transacted.
+ */
+ Boolean isTransacted();
+
+ /**
+ * Specifies whether to use transacted mode for sending/receiving messages using the InOnly.
+ *
+ * @param transacted Should session be transacted.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setTransacted(Boolean transacted);
+
+ /**
+ * The Spring transaction manager to use.
+ *
+ * @return Transaction manager.
+ */
+ String getTransactionManager();
+
+ /**
+ * Specifies transaction manager to use with endpoint.
+ *
+ * @param transactionManager Spring transaction manager bean.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setTransactionManager(String transactionManager);
+
+ /**
+ * The JMS acknowledgement mode name to use.
+ *
+ * @return Acknowledgement Mode Name.
+ */
+ String getAcknowledgementModeName();
+
+ /**
+ * Specifies the JMS acknowledgement mode name to use with endpoint.
+ * One of SESSION_TRANSACTED, CLIENT_ACKNOWLEDGE, AUTO_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE
+ *
+ * @param acknowledgementModeName String describing the JMS acknowledgement mode.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setAcknowledgementModeName(String acknowledgementModeName);
+
+ /**
+ * The Integer value of the JMS acknowledgement mode to use.
+ *
+ * @return Acknowledgement Mode.
+ */
+ Integer getAcknowledgementMode();
+
+ /**
+ * Specifies Integer value of the JMS acknowledgement mode to use with endpoint.
+ * Primarily facilitates vendor specific extensions beyond the standard values
+ *
+ * @param acknowledgementMode Integer describing the JMS acknowledgement mode.
+ * @return a reference to this Camel binding model
+ */
+ CamelJmsBindingModel setAcknowledgementMode(Integer acknowledgementMode);
+
+}
diff --git a/components/camel/camel-jms/src/main/java/org/switchyard/component/camel/jms/model/CamelJmsNamespace.java b/components/camel/camel-jms/src/main/java/org/switchyard/component/camel/jms/model/CamelJmsNamespace.java
new file mode 100644
index 000000000..4084cfa09
--- /dev/null
+++ b/components/camel/camel-jms/src/main/java/org/switchyard/component/camel/jms/model/CamelJmsNamespace.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jms.model;
+
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Namespace;
+
+/**
+ * A Camel Jms config model namespace.
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+public enum CamelJmsNamespace implements Namespace {
+
+ /** The 1.0 namespace. */
+ V_1_0("1.0"),
+ /** The 1.1 namespace. */
+ V_1_1("1.1"),
+ /** The 2.0 namespace. */
+ V_2_0("2.0"),
+ /** The default namespace. */
+ DEFAULT(null);
+
+ private final Util _util;
+
+ /**
+ * Constructs a new CamelJmsNamespace with the specified version.
+ * @param version the specified version, or null to discover the default
+ */
+ CamelJmsNamespace(String version) {
+ _util = new Util(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String section() {
+ return _util.section();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String version() {
+ return _util.version();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean versionMatches(Namespace namespace) {
+ return _util.versionMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String uri() {
+ return _util.uri();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean uriMatches(Namespace namespace) {
+ return _util.uriMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDefault() {
+ return this == DEFAULT || uriMatches(DEFAULT);
+ }
+
+ /**
+ * Gets the CamelJmsNamespace for the specified uri, or null if no matching uris are found.
+ * @param uri the uri
+ * @return the CamelJmsNamespace
+ */
+ public static CamelJmsNamespace fromUri(String uri) {
+ return Util.fromUri(CamelJmsNamespace.class, uri);
+ }
+
+ @SuppressWarnings("serial")
+ private static final class Util extends Namespace.Util {
+ // static final since we only want to do the somewhat expensive work of instantiating this once!
+ private static final Descriptor DESCRIPTOR = new Descriptor(CamelJmsNamespace.class);
+ private Util(String version) {
+ super(DESCRIPTOR, "urn:switchyard-component-camel-jms:config", version);
+ }
+ }
+
+}
diff --git a/components/camel/camel-jms/src/main/java/org/switchyard/component/camel/jms/model/v1/V1CamelJmsBindingModel.java b/components/camel/camel-jms/src/main/java/org/switchyard/component/camel/jms/model/v1/V1CamelJmsBindingModel.java
new file mode 100644
index 000000000..ddcfd2717
--- /dev/null
+++ b/components/camel/camel-jms/src/main/java/org/switchyard/component/camel/jms/model/v1/V1CamelJmsBindingModel.java
@@ -0,0 +1,346 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jms.model.v1;
+
+import java.net.URI;
+import java.util.List;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelBindingModel;
+import org.switchyard.component.camel.jms.model.CamelJmsBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * Implementation of {@link CamelJmsBindingModel}.
+ */
+public class V1CamelJmsBindingModel extends V1BaseCamelBindingModel
+ implements CamelJmsBindingModel {
+
+ /**
+ * Camel endpoint type.
+ */
+ public static final String JMS = "jms";
+
+ private static final String QUEUE = "queue";
+ private static final String TOPIC = "topic";
+ private static final String CONNECTION_FACTORY = "connectionFactory";
+ private static final String USERNAME = "username";
+ private static final String PASSWORD = "password";
+ private static final String CLIENT_ID = "clientId";
+ private static final String DURABLE_SUBSCRIPTION_NAME = "durableSubscriptionName";
+ private static final String CONCURRENT_CONSUMERS = "concurrentConsumers";
+ private static final String MAX_CONCURRENT_CONSUMERS = "maxConcurrentConsumers";
+ private static final String DISABLE_REPLY_TO = "disableReplyTo";
+ private static final String PRESERVE_MESSAGE_QOS = "preserveMessageQos";
+ private static final String DELIVERY_PERSISTENT = "deliveryPersistent";
+ private static final String PRIORITY = "priority";
+ private static final String EXPLICIT_QOS_ENABLED = "explicitQosEnabled";
+ private static final String REPLY_TO = "replyTo";
+ private static final String REPLY_TO_TYPE = "replyToType";
+ private static final String REQUEST_TIMEOUT = "requestTimeout";
+ private static final String SELECTOR = "selector";
+ private static final String TIME_TO_LIVE = "timeToLive";
+ private static final String TRANSACTED = "transacted";
+ private static final String TRANSACTION_MANAGER = "transactionManager";
+ private static final String ACKNOWLEDGEMENTMODE_NAME = "acknowledgementModeName";
+ private static final String ACKNOWLEDGEMENTMODE = "acknowledgementMode";
+
+ /**
+ * Create a new CamelJmsBindingModel.
+ * @param namespace namespace
+ */
+ public V1CamelJmsBindingModel(String namespace) {
+ this(JMS, namespace);
+ }
+
+ /**
+ * Create a binding model from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param descriptor The switchyard descriptor instance.
+ */
+ public V1CamelJmsBindingModel(Configuration config, Descriptor descriptor) {
+ super(config, descriptor);
+ }
+
+ /**
+ * Extension constructor.
+ *
+ * @param type Type of binding.
+ * @param namespace Binding namespace.
+ */
+ protected V1CamelJmsBindingModel(String type, String namespace) {
+ super(type, namespace);
+ setModelChildrenOrder(QUEUE, TOPIC, CONNECTION_FACTORY, USERNAME, PASSWORD,
+ CLIENT_ID, DURABLE_SUBSCRIPTION_NAME, CONCURRENT_CONSUMERS, MAX_CONCURRENT_CONSUMERS,
+ DISABLE_REPLY_TO, PRESERVE_MESSAGE_QOS, DELIVERY_PERSISTENT, PRIORITY,
+ EXPLICIT_QOS_ENABLED, REPLY_TO, REPLY_TO_TYPE, REQUEST_TIMEOUT, SELECTOR,
+ TIME_TO_LIVE, TRANSACTED, TRANSACTION_MANAGER);
+ }
+
+ @Override
+ public String getQueue() {
+ return getConfig(QUEUE);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setQueue(String queue) {
+ return setConfig(QUEUE, queue);
+ }
+
+ @Override
+ public String getTopic() {
+ return getConfig(TOPIC);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setTopic(String topic) {
+ return setConfig(TOPIC, topic);
+ }
+
+ @Override
+ public String getConnectionFactory() {
+ return getConfig(CONNECTION_FACTORY);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setConnectionFactory(String connectionFactory) {
+ return setConfig(CONNECTION_FACTORY, connectionFactory);
+ }
+
+ @Override
+ public String getUsername() {
+ return getConfig(USERNAME);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setUsername(String username) {
+ return setConfig(USERNAME, username);
+ }
+
+ @Override
+ public String getPassword() {
+ return getConfig(PASSWORD);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setPassword(String password) {
+ return setConfig(PASSWORD, password);
+ }
+
+ @Override
+ public String getClientId() {
+ return getConfig(CLIENT_ID);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setClientId(String clientId) {
+ return setConfig(CLIENT_ID, clientId);
+ }
+
+ @Override
+ public String getDurableSubscriptionName() {
+ return getConfig(DURABLE_SUBSCRIPTION_NAME);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setDurableSubscriptionName(String durableSubscriptionName) {
+ return setConfig(DURABLE_SUBSCRIPTION_NAME, durableSubscriptionName);
+ }
+
+ @Override
+ public Integer getConcurrentConsumers() {
+ return getIntegerConfig(CONCURRENT_CONSUMERS);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setConcurrentConsumers(Integer concurrentConsumers) {
+ return setConfig(CONCURRENT_CONSUMERS, concurrentConsumers);
+ }
+
+ @Override
+ public Integer getMaxConcurrentConsumers() {
+ return getIntegerConfig(MAX_CONCURRENT_CONSUMERS);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setMaxConcurrentConsumers(Integer maxConcurrentConsumers) {
+ return setConfig(MAX_CONCURRENT_CONSUMERS, maxConcurrentConsumers);
+ }
+
+ @Override
+ public Boolean isDisableReplyTo() {
+ return getBooleanConfig(DISABLE_REPLY_TO);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setDisableReplyTo(Boolean disableReplyTo) {
+ return setConfig(DISABLE_REPLY_TO, disableReplyTo);
+ }
+
+ @Override
+ public Boolean isPreserveMessageQos() {
+ return getBooleanConfig(PRESERVE_MESSAGE_QOS);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setPreserveMessageQos(Boolean preserveMessageQos) {
+ return setConfig(PRESERVE_MESSAGE_QOS, preserveMessageQos);
+ }
+
+ @Override
+ public Boolean isDeliveryPersistent() {
+ return getBooleanConfig(DELIVERY_PERSISTENT);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setDeliveryPersistent(Boolean deliveryPersistent) {
+ return setConfig(DELIVERY_PERSISTENT, deliveryPersistent);
+ }
+
+ @Override
+ public Integer getPriority() {
+ return getIntegerConfig(PRIORITY);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setPriority(Integer priority) {
+ return setConfig(PRIORITY, priority);
+ }
+
+ @Override
+ public Boolean isExplicitQosEnabled() {
+ return getBooleanConfig(EXPLICIT_QOS_ENABLED);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setExplicitQosEnabled(Boolean explicitQosEnabled) {
+ return setConfig(EXPLICIT_QOS_ENABLED, explicitQosEnabled);
+ }
+
+ @Override
+ public String getReplyTo() {
+ return getConfig(REPLY_TO);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setReplyTo(String replyTo) {
+ return setConfig(REPLY_TO, replyTo);
+ }
+
+ @Override
+ public String getReplyToType() {
+ return getConfig(REPLY_TO_TYPE);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setReplyToType(String replyToType) {
+ return setConfig(REPLY_TO_TYPE, replyToType);
+ }
+
+ @Override
+ public Integer getRequestTimeout() {
+ return getIntegerConfig(REQUEST_TIMEOUT);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setRequestTimeout(Integer requestTimeout) {
+ return setConfig(REQUEST_TIMEOUT, requestTimeout);
+ }
+
+ @Override
+ public String getSelector() {
+ return getConfig(SELECTOR);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setSelector(String selector) {
+ return setConfig(SELECTOR, selector);
+ }
+
+ @Override
+ public Integer getTimeToLive() {
+ return getIntegerConfig(TIME_TO_LIVE);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setTimeToLive(Integer timeToLive) {
+ return setConfig(TIME_TO_LIVE, timeToLive);
+ }
+
+ @Override
+ public Boolean isTransacted() {
+ return getBooleanConfig(TRANSACTED);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setTransacted(Boolean transacted) {
+ return setConfig(TRANSACTED, transacted);
+ }
+
+ @Override
+ public String getTransactionManager() {
+ return getConfig(TRANSACTION_MANAGER);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setTransactionManager(String transactionManager) {
+ return setConfig(TRANSACTION_MANAGER, transactionManager);
+ }
+
+ @Override
+ public String getAcknowledgementModeName() {
+ return getConfig(ACKNOWLEDGEMENTMODE_NAME);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setAcknowledgementModeName(
+ String acknowledgementModeName) {
+ return setConfig(ACKNOWLEDGEMENTMODE_NAME, acknowledgementModeName);
+ }
+
+ @Override
+ public Integer getAcknowledgementMode() {
+ return getIntegerConfig(ACKNOWLEDGEMENTMODE);
+ }
+
+ @Override
+ public V1CamelJmsBindingModel setAcknowledgementMode(Integer acknowledgementMode) {
+ return setConfig(ACKNOWLEDGEMENTMODE, acknowledgementMode);
+ }
+
+ @Override
+ public URI getComponentURI() {
+ return getComponentURI(JMS);
+ }
+
+ protected URI getComponentURI(String prefix) {
+ Configuration modelConfiguration = getModelConfiguration();
+ List children = modelConfiguration.getChildren();
+
+ String baseUri = prefix + ":";
+ if (getQueue() != null) {
+ baseUri += "queue:" + getQueue();
+ } else if (getTopic() != null) {
+ baseUri += "topic:" + getTopic();
+ }
+
+ QueryString queryStr = new QueryString();
+ traverseConfiguration(children, queryStr, QUEUE, TOPIC);
+
+ return URI.create(baseUri + queryStr.toString());
+ }
+
+}
diff --git a/components/camel/camel-jms/src/main/java/org/switchyard/component/camel/jms/model/v1/V1CamelJmsModelMarshaller.java b/components/camel/camel-jms/src/main/java/org/switchyard/component/camel/jms/model/v1/V1CamelJmsModelMarshaller.java
new file mode 100644
index 000000000..fab5d36db
--- /dev/null
+++ b/components/camel/camel-jms/src/main/java/org/switchyard/component/camel/jms/model/v1/V1CamelJmsModelMarshaller.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jms.model.v1;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelMarshaller;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+import org.switchyard.config.model.composite.BindingModel;
+
+/**
+ * Jms model marshaller.
+ */
+public class V1CamelJmsModelMarshaller extends V1BaseCamelMarshaller {
+
+ private static final String BINDING_JMS = BindingModel.BINDING + '.' + V1CamelJmsBindingModel.JMS;
+
+ /**
+ * Creates new marshaller.
+ *
+ * @param desc Descriptor
+ */
+ public V1CamelJmsModelMarshaller(Descriptor desc) {
+ super(desc);
+ }
+
+ /**
+ * Reads in the Configuration, looking for various knowledge models.
+ * If not found, it falls back to the super class (V1BaseCamelMarshaller).
+ *
+ * @param config the Configuration
+ * @return the Model
+ */
+ @Override
+ public Model read(Configuration config) {
+ String name = config.getName();
+ Descriptor desc = getDescriptor();
+ if (BINDING_JMS.equals(name)) {
+ return new V1CamelJmsBindingModel(config, desc);
+ }
+ return super.read(config);
+ }
+
+}
diff --git a/components/camel/camel-jms/src/main/resources/META-INF/services/org.switchyard.deploy.Component b/components/camel/camel-jms/src/main/resources/META-INF/services/org.switchyard.deploy.Component
new file mode 100644
index 000000000..7a883e710
--- /dev/null
+++ b/components/camel/camel-jms/src/main/resources/META-INF/services/org.switchyard.deploy.Component
@@ -0,0 +1 @@
+org.switchyard.component.camel.jms.deploy.CamelJmsComponent
diff --git a/components/camel/camel-jms/src/main/resources/org/switchyard/component/camel/jms/model/v1/camel-jms_1_0.xsd b/components/camel/camel-jms/src/main/resources/org/switchyard/component/camel/jms/model/v1/camel-jms_1_0.xsd
new file mode 100644
index 000000000..6ec8805b1
--- /dev/null
+++ b/components/camel/camel-jms/src/main/resources/org/switchyard/component/camel/jms/model/v1/camel-jms_1_0.xsd
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-jms/src/main/resources/org/switchyard/component/camel/jms/model/v1/camel-jms_1_1.xsd b/components/camel/camel-jms/src/main/resources/org/switchyard/component/camel/jms/model/v1/camel-jms_1_1.xsd
new file mode 100644
index 000000000..fdc01f00f
--- /dev/null
+++ b/components/camel/camel-jms/src/main/resources/org/switchyard/component/camel/jms/model/v1/camel-jms_1_1.xsd
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-jms/src/main/resources/org/switchyard/component/camel/jms/model/v2/camel-jms_2_0.xsd b/components/camel/camel-jms/src/main/resources/org/switchyard/component/camel/jms/model/v2/camel-jms_2_0.xsd
new file mode 100644
index 000000000..eb3d2170b
--- /dev/null
+++ b/components/camel/camel-jms/src/main/resources/org/switchyard/component/camel/jms/model/v2/camel-jms_2_0.xsd
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-jms/src/main/resources/org/switchyard/config/model/descriptor.properties b/components/camel/camel-jms/src/main/resources/org/switchyard/config/model/descriptor.properties
new file mode 100644
index 000000000..92b2c696f
--- /dev/null
+++ b/components/camel/camel-jms/src/main/resources/org/switchyard/config/model/descriptor.properties
@@ -0,0 +1,32 @@
+# Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+
+camel_jms_1_0.section=urn:switchyard-component-camel-jms:config
+camel_jms_1_0.version=1.0
+camel_jms_1_0.namespace=urn:switchyard-component-camel-jms:config:1.0
+camel_jms_1_0.schema=camel-jms_1_0.xsd
+camel_jms_1_0.location=/org/switchyard/component/camel/jms/model/v1/
+camel_jms_1_0.marshaller=org.switchyard.component.camel.jms.model.v1.V1CamelJmsModelMarshaller
+
+camel_jms_1_1.section=urn:switchyard-component-camel-jms:config
+camel_jms_1_1.version=1.1
+camel_jms_1_1.namespace=urn:switchyard-component-camel-jms:config:1.1
+camel_jms_1_1.schema=camel-jms_1_1.xsd
+camel_jms_1_1.location=/org/switchyard/component/camel/jms/model/v1/
+camel_jms_1_1.marshaller=org.switchyard.component.camel.jms.model.v1.V1CamelJmsModelMarshaller
+
+camel_jms_2_0.section=urn:switchyard-component-camel-jms:config
+camel_jms_2_0.version=2.0
+camel_jms_2_0.namespace=urn:switchyard-component-camel-jms:config:2.0
+camel_jms_2_0.schema=camel-jms_2_0.xsd
+camel_jms_2_0.location=/org/switchyard/component/camel/jms/model/v2/
+camel_jms_2_0.marshaller=org.switchyard.component.camel.jms.model.v1.V1CamelJmsModelMarshaller
diff --git a/components/camel/camel-jms/src/test/java/org/switchyard/component/camel/jms/model/v1/V1CamelJmsBindingModelTest.java b/components/camel/camel-jms/src/test/java/org/switchyard/component/camel/jms/model/v1/V1CamelJmsBindingModelTest.java
new file mode 100644
index 000000000..47d611cdc
--- /dev/null
+++ b/components/camel/camel-jms/src/test/java/org/switchyard/component/camel/jms/model/v1/V1CamelJmsBindingModelTest.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jms.model.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.camel.component.jms.JmsEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.jms.model.CamelJmsNamespace;
+
+/**
+ * Test for {@link V1CamelJmsBindingModel}.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V1CamelJmsBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-jms-binding-beans.xml";
+
+ private static String TOPIC = "esb_in_topic";
+ private static String CONNECTION_FACTORY = "connFactory";
+ private static String USERNAME = "camel";
+ private static String PASSWORD = "isMyFriend";
+ private static String CLIENT_ID = "esb_in";
+ private static String DURABLE_SUBSCRIPTION_NAME = "esb_in_sub";
+ private static Integer CONCURRENT_CONSUMERS = 5;
+ private static Integer MAX_CONCURRENT_CONSUMERS = 15;
+ private static Boolean DISABLE_REPLY_TO = true;
+ private static Boolean PRESERVE_MESSAGE_QOS = true;
+ private static Boolean DELIVERY_PERSISTENT = false;
+ private static Integer PRIORITY = 9;
+ private static Boolean EXPLICIT_QOS_ENABLED = true;
+ private static String REPLY_TO = "esb_out";
+ private static String REPLY_TO_TYPE= "Shared";
+ private static Integer REQUEST_TIMEOUT = 300;
+ private static String SELECTOR = "DEST='ESB'";
+ private static Integer TIME_TO_LIVE = 3600;
+ private static Boolean TRANSACTED = true;
+ private static String ACKNOWLEDGEMENTMODE_NAME = "AUTO_ACKNOWLEDGE";
+ private static Integer ACKNOWLEDGEMENTMODE = -1;
+
+ private static final String CAMEL_URI = "jms:topic:esb_in_topic?connectionFactory=connFactory&" +
+ "username=camel&password=isMyFriend&clientId=esb_in&durableSubscriptionName=esb_in_sub&" +
+ "concurrentConsumers=5&maxConcurrentConsumers=15&disableReplyTo=true&preserveMessageQos=true&" +
+ "deliveryPersistent=false&priority=9&explicitQosEnabled=true&replyTo=esb_out&replyToType=Shared&" +
+ "requestTimeout=300&selector=DEST='ESB'&timeToLive=3600&transacted=true&acknowledgementModeName=AUTO_ACKNOWLEDGE&acknowledgementMode=-1";
+
+ public V1CamelJmsBindingModelTest() {
+ super(JmsEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V1CamelJmsBindingModel createTestModel() {
+ return (V1CamelJmsBindingModel) new V1CamelJmsBindingModel(CamelJmsNamespace.V_1_1.uri())
+ .setTopic(TOPIC)
+ .setConnectionFactory(CONNECTION_FACTORY)
+ .setUsername(USERNAME)
+ .setPassword(PASSWORD)
+ .setClientId(CLIENT_ID)
+ .setDurableSubscriptionName(DURABLE_SUBSCRIPTION_NAME)
+ .setConcurrentConsumers(CONCURRENT_CONSUMERS)
+ .setMaxConcurrentConsumers(MAX_CONCURRENT_CONSUMERS)
+ .setDisableReplyTo(DISABLE_REPLY_TO)
+ .setPreserveMessageQos(PRESERVE_MESSAGE_QOS)
+ .setDeliveryPersistent(DELIVERY_PERSISTENT)
+ .setPriority(PRIORITY)
+ .setExplicitQosEnabled(EXPLICIT_QOS_ENABLED)
+ .setReplyTo(REPLY_TO)
+ .setReplyToType(REPLY_TO_TYPE)
+ .setRequestTimeout(REQUEST_TIMEOUT)
+ .setSelector(SELECTOR)
+ .setTimeToLive(TIME_TO_LIVE)
+ .setTransacted(TRANSACTED)
+ .setAcknowledgementModeName(ACKNOWLEDGEMENTMODE_NAME)
+ .setAcknowledgementMode(ACKNOWLEDGEMENTMODE);
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelJmsBindingModel model) {
+ assertEquals(TOPIC, model.getTopic());
+ assertEquals(CONNECTION_FACTORY, model.getConnectionFactory());
+ assertEquals(USERNAME, model.getUsername());
+ assertEquals(PASSWORD, model.getPassword());
+ assertEquals(CLIENT_ID, model.getClientId());
+ assertEquals(DURABLE_SUBSCRIPTION_NAME, model.getDurableSubscriptionName());
+ assertEquals(CONCURRENT_CONSUMERS, model.getConcurrentConsumers());
+ assertEquals(MAX_CONCURRENT_CONSUMERS, model.getMaxConcurrentConsumers());
+ assertEquals(DISABLE_REPLY_TO, model.isDisableReplyTo());
+ assertEquals(PRESERVE_MESSAGE_QOS, model.isPreserveMessageQos());
+ assertEquals(DELIVERY_PERSISTENT, model.isDeliveryPersistent());
+ assertEquals(PRIORITY, model.getPriority());
+ assertEquals(EXPLICIT_QOS_ENABLED, model.isExplicitQosEnabled());
+ assertEquals(REPLY_TO, model.getReplyTo());
+ assertEquals(REPLY_TO_TYPE, model.getReplyToType());
+ assertEquals(REQUEST_TIMEOUT, model.getRequestTimeout());
+ assertEquals(SELECTOR, model.getSelector());
+ assertEquals(TIME_TO_LIVE, model.getTimeToLive());
+ assertEquals(TRANSACTED, model.isTransacted());
+ assertEquals(ACKNOWLEDGEMENTMODE_NAME, model.getAcknowledgementModeName());
+ assertEquals(ACKNOWLEDGEMENTMODE, model.getAcknowledgementMode());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-jms/src/test/resources/v1/switchyard-invalid-jms-binding-beans.xml b/components/camel/camel-jms/src/test/resources/v1/switchyard-invalid-jms-binding-beans.xml
new file mode 100644
index 000000000..fe4941658
--- /dev/null
+++ b/components/camel/camel-jms/src/test/resources/v1/switchyard-invalid-jms-binding-beans.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+ esb_in_queue
+ esb_in_topic
+
+
+
+
+
diff --git a/components/camel/camel-jms/src/test/resources/v1/switchyard-jms-binding-beans.xml b/components/camel/camel-jms/src/test/resources/v1/switchyard-jms-binding-beans.xml
new file mode 100644
index 000000000..3438f99cc
--- /dev/null
+++ b/components/camel/camel-jms/src/test/resources/v1/switchyard-jms-binding-beans.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+ esb_in_topic
+ connFactory
+ camel
+ isMyFriend
+ esb_in
+ esb_in_sub
+ 5
+ 15
+ true
+ true
+ false
+ 9
+ true
+ esb_out
+ Shared
+ 300
+ DEST='ESB'
+ 3600
+ true
+ AUTO_ACKNOWLEDGE
+ -1
+
+
+
+
+
diff --git a/components/camel/camel-jpa/pom.xml b/components/camel/camel-jpa/pom.xml
new file mode 100644
index 000000000..2efaf0419
--- /dev/null
+++ b/components/camel/camel-jpa/pom.xml
@@ -0,0 +1,76 @@
+
+
+
+ 4.0.0
+
+ org.switchyard.components
+ switchyard-component-camel-parent
+ 2.1.0-SNAPSHOT
+
+ switchyard-component-camel-jpa
+ bundle
+ SwitchYard: Camel Component :: JPA Binding
+ http://switchyard.org
+
+
+ org.switchyard.component.camel.jpa.*
+
+
+ org.apache.camel.component.jpa,
+ org.switchyard.config.model;org.switchyard.*;${switchyard.osgi.import.switchyard.version},
+ *
+
+
+
+
+ org.switchyard
+ switchyard-api
+
+
+ org.switchyard
+ switchyard-common-camel
+
+
+ org.switchyard.components
+ switchyard-component-common
+
+
+ org.switchyard.components
+ switchyard-component-common-camel
+
+
+ org.switchyard.components
+ switchyard-component-camel-switchyard
+
+
+ org.apache.camel
+ camel-core
+
+
+ org.apache.camel
+ camel-jpa
+
+
+ org.hibernate.javax.persistence
+ hibernate-jpa-2.0-api
+ compile
+
+
+ org.switchyard.components
+ switchyard-component-camel-test
+ test
+
+
+
diff --git a/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/deploy/CamelJpaActivator.java b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/deploy/CamelJpaActivator.java
new file mode 100644
index 000000000..7a9d47d25
--- /dev/null
+++ b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/deploy/CamelJpaActivator.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jpa.deploy;
+
+import javax.xml.namespace.QName;
+
+import org.switchyard.common.camel.SwitchYardCamelContext;
+import org.switchyard.component.camel.common.composer.CamelComposition;
+import org.switchyard.component.camel.common.deploy.BaseBindingActivator;
+import org.switchyard.component.camel.common.handler.InboundHandler;
+import org.switchyard.component.camel.common.handler.OutboundHandler;
+import org.switchyard.component.camel.common.model.CamelBindingModel;
+import org.switchyard.component.camel.jpa.model.CamelJpaBindingModel;
+
+/**
+ * Camel jpa activator.
+ */
+public class CamelJpaActivator extends BaseBindingActivator {
+
+ /**
+ * Creates new activator instance.
+ *
+ * @param context Camel context.
+ * @param types Activation types.
+ */
+ public CamelJpaActivator(SwitchYardCamelContext context, String[] types) {
+ super(context, types);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected InboundHandler createInboundHandler(QName serviceName, CamelBindingModel binding) {
+ return new CamelJpaInboundHandler((CamelJpaBindingModel)binding, getCamelContext(), serviceName, getServiceDomain());
+ }
+
+ @Override
+ protected OutboundHandler createOutboundHandler(CamelBindingModel binding) {
+ return new CamelJpaOutboundHandler((CamelJpaBindingModel)binding, getCamelContext(), CamelComposition.getMessageComposer(binding), getServiceDomain());
+ }
+}
diff --git a/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/deploy/CamelJpaComponent.java b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/deploy/CamelJpaComponent.java
new file mode 100644
index 000000000..4d591a222
--- /dev/null
+++ b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/deploy/CamelJpaComponent.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jpa.deploy;
+
+import org.switchyard.common.camel.SwitchYardCamelContext;
+import org.switchyard.component.camel.common.deploy.BaseBindingActivator;
+import org.switchyard.component.camel.common.deploy.BaseBindingComponent;
+import org.switchyard.component.camel.jpa.model.v1.V1CamelJpaBindingModel;
+
+/**
+ * Jpa binding component.
+ */
+public class CamelJpaComponent extends BaseBindingComponent {
+
+ /**
+ * Creates new component.
+ */
+ public CamelJpaComponent() {
+ super("CamelJpaComponent", V1CamelJpaBindingModel.JPA);
+ }
+
+ @Override
+ protected BaseBindingActivator createActivator(SwitchYardCamelContext context, String... types) {
+ return new CamelJpaActivator(context, types);
+ }
+}
diff --git a/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/deploy/CamelJpaInboundHandler.java b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/deploy/CamelJpaInboundHandler.java
new file mode 100644
index 000000000..e25c12b3b
--- /dev/null
+++ b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/deploy/CamelJpaInboundHandler.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jpa.deploy;
+
+import java.util.HashMap;
+
+import javax.persistence.EntityManagerFactory;
+import javax.xml.namespace.QName;
+
+import org.apache.camel.model.RouteDefinition;
+import org.switchyard.ServiceDomain;
+import org.switchyard.common.camel.SwitchYardCamelContext;
+import org.switchyard.component.camel.common.handler.InboundHandler;
+import org.switchyard.component.camel.jpa.model.CamelJpaBindingModel;
+
+/**
+ * Inbound handler for JPA binding. Resolve EntityManagerFactory instance in case it runs on OSGi container.
+ */
+public class CamelJpaInboundHandler extends InboundHandler {
+
+ /**
+ * Sole constructor.
+ *
+ * @param camelBindingModel The CamelBindingModel.
+ * @param camelContext The camel context instance.
+ * @param serviceName The target service name.
+ * @param domain the service domain.
+ */
+ public CamelJpaInboundHandler(CamelJpaBindingModel camelBindingModel,
+ SwitchYardCamelContext camelContext, QName serviceName, ServiceDomain domain) {
+ super(camelBindingModel, camelContext, serviceName, domain);
+ }
+
+ @Override
+ protected RouteDefinition createRouteDefinition() {
+ CamelJpaBindingModel bindingModel = getBindingModel();
+ EntityManagerFactory emf = EntityManagerFactoryLocator.locateEntityManagerFactory(bindingModel.getPersistenceUnit(), new HashMap());
+ if (emf != null) {
+ getSwitchYardCamelContext().getWritebleRegistry().put(EntityManagerFactory.class.getName(), emf);
+ }
+
+ return super.createRouteDefinition();
+ }
+
+}
diff --git a/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/deploy/CamelJpaOutboundHandler.java b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/deploy/CamelJpaOutboundHandler.java
new file mode 100644
index 000000000..f106cacf0
--- /dev/null
+++ b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/deploy/CamelJpaOutboundHandler.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jpa.deploy;
+
+import java.util.HashMap;
+
+import javax.persistence.EntityManagerFactory;
+
+import org.apache.camel.ProducerTemplate;
+import org.switchyard.ServiceDomain;
+import org.switchyard.common.camel.SwitchYardCamelContext;
+import org.switchyard.component.camel.common.composer.CamelBindingData;
+import org.switchyard.component.camel.common.handler.OutboundHandler;
+import org.switchyard.component.camel.jpa.model.CamelJpaBindingModel;
+import org.switchyard.component.common.composer.MessageComposer;
+
+/**
+ * Outbound handler for JPA binding. Resolve EntityManagerFactory instance in case it runs on OSGi container.
+ */
+public class CamelJpaOutboundHandler extends OutboundHandler {
+
+ /**
+ * A constructor. @see OutboundHandler#OutboundHandler(CamelBindingModel, SwitchYardCamelContext, MessageComposer, ProducerTemplate, ServiceDomain)
+ * @param binding binding model
+ * @param context camel context
+ * @param messageComposer message composer
+ * @param producerTemplate producer template
+ * @param domain service domain
+ */
+ public CamelJpaOutboundHandler(CamelJpaBindingModel binding,
+ SwitchYardCamelContext context,
+ MessageComposer messageComposer,
+ ProducerTemplate producerTemplate, ServiceDomain domain) {
+ super(binding, context, messageComposer, producerTemplate, domain);
+
+ EntityManagerFactory emf = EntityManagerFactoryLocator.locateEntityManagerFactory(binding.getPersistenceUnit(), new HashMap());
+ if (emf != null) {
+ context.getWritebleRegistry().put(EntityManagerFactory.class.getName(), emf);
+ }
+ }
+
+ /**
+ * A constructor. @see OutboundHandler#OutboundHandler(CamelBindingModel, SwitchYardCamelContext, MessageComposer, ServiceDomain)
+ * @param binding binding
+ * @param context camel context
+ * @param messageComposer message composer
+ * @param domain service domain
+ */
+ public CamelJpaOutboundHandler(CamelJpaBindingModel binding,
+ SwitchYardCamelContext context,
+ MessageComposer messageComposer,
+ ServiceDomain domain) {
+ this(binding, context, messageComposer, null, domain);
+ }
+}
diff --git a/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/deploy/EntityManagerFactoryLocator.java b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/deploy/EntityManagerFactoryLocator.java
new file mode 100644
index 000000000..8ebfc70f1
--- /dev/null
+++ b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/deploy/EntityManagerFactoryLocator.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jpa.deploy;
+
+import java.util.Map;
+
+import javax.naming.InitialContext;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.spi.PersistenceProvider;
+
+import org.jboss.logging.Logger;
+
+/**
+ * EntityManagerFactory locator for Camel JPA component.
+ */
+public final class EntityManagerFactoryLocator {
+
+ private static Logger _logger = Logger.getLogger(EntityManagerFactoryLocator.class);
+
+ /**
+ * OSGi specific PersistenceProvider JNDI name.
+ */
+ public static final String OSGI_PERSISTENCE_PROVIDER_JNDI_NAME = "osgi:service/javax.persistence.spi.PersistenceProvider";
+
+ /**
+ * OSGi specific EntityManagerFactory JNDI name.
+ */
+ public static final String OSGI_ENTITY_MANAGER_FACTORY_JNDI_NAME = "osgi:service/javax.persistence.EntityManagerFactory";
+
+ private EntityManagerFactoryLocator() {
+ }
+
+ /**
+ * Lookup EntityManagerFactory from JNDI.
+ * @param unitName JPA unit name.
+ * @param props A Map of properties for use by the persistence provider.
+ * @return EntityManagerFactory
+ */
+ public static EntityManagerFactory locateEntityManagerFactory(String unitName, Map,?> props) {
+ InitialContext ic = null;
+ try {
+ ic = new InitialContext();
+ } catch (Exception e) {
+ _logger.debug(e);
+ return null;
+ }
+
+ try {
+ EntityManagerFactory emf = (EntityManagerFactory) lookupInJndi(ic, OSGI_ENTITY_MANAGER_FACTORY_JNDI_NAME);
+ if (emf != null) {
+ return emf;
+ }
+
+ PersistenceProvider pp = (PersistenceProvider) lookupInJndi(ic, OSGI_PERSISTENCE_PROVIDER_JNDI_NAME);
+ if (pp != null) {
+ return pp.createEntityManagerFactory(unitName, props);
+ }
+ } finally {
+ try {
+ ic.close();
+ } catch (Exception e) {
+ _logger.debug(e);
+ }
+ }
+ return null;
+ }
+
+ private static Object lookupInJndi(InitialContext ic, String name) {
+ try {
+ return ic.lookup(name);
+ } catch (Exception e) {
+ _logger.debug(e);
+ return null;
+ }
+ }
+}
diff --git a/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/CamelJpaBindingModel.java b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/CamelJpaBindingModel.java
new file mode 100644
index 000000000..7f25730a5
--- /dev/null
+++ b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/CamelJpaBindingModel.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jpa.model;
+
+import org.switchyard.component.camel.common.model.CamelBindingModel;
+
+/**
+ * Jpa binding model definition.
+ *
+ * @author Lukasz Dywicki
+ */
+public interface CamelJpaBindingModel extends CamelBindingModel {
+
+ /**
+ * The entity class name.
+ *
+ * @return Name of entity class.
+ */
+ String getEntityClassName();
+
+ /**
+ * Specify JPA entity class name.
+ *
+ * @param entityClassName Class name.
+ * @return a reference to this binding model
+ */
+ CamelJpaBindingModel setEntityClassName(String entityClassName);
+
+ /**
+ * Name of persistence unit.
+ *
+ * @return Persistence unit.
+ */
+ String getPersistenceUnit();
+
+ /**
+ * Specify name of persistence unit used by camel.
+ *
+ * @param persistenceUnit Persistence unit name.
+ * @return a reference to this binding model
+ */
+ CamelJpaBindingModel setPersistenceUnit(String persistenceUnit);
+
+ /**
+ * Name of Spring platform transaction manager to use.
+ *
+ * @return Transaction manager bean name.
+ */
+ String getTransactionManager();
+
+ /**
+ * Specify name of Spring transaction manager bean used for transaction
+ * handling.
+ *
+ * @param transactionManager Name of transaction manager bean.
+ * @return a reference to this binding model
+ */
+ CamelJpaBindingModel setTransactionManager(String transactionManager);
+
+ /**
+ * The consumer's configurations.
+ *
+ * @return an instance of the camel jpa consumer binding model
+ */
+ CamelJpaConsumerBindingModel getConsumer();
+
+ /**
+ * Specify the consumer binding model.
+ *
+ * @param consumer The consumer binding model
+ * @return a reference to this binding model
+ */
+ CamelJpaBindingModel setConsumer(CamelJpaConsumerBindingModel consumer);
+
+ /**
+ * The producer's configurations.
+ *
+ * @return an instance of the camel jpa producer binding model
+ */
+ CamelJpaProducerBindingModel getProducer();
+
+ /**
+ * Specify the producer binding model.
+ *
+ * @param producer The producer binding model
+ * @return a reference to this binding model
+ */
+ CamelJpaBindingModel setProducer(CamelJpaProducerBindingModel producer);
+
+
+
+}
diff --git a/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/CamelJpaConsumerBindingModel.java b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/CamelJpaConsumerBindingModel.java
new file mode 100644
index 000000000..13c281c2b
--- /dev/null
+++ b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/CamelJpaConsumerBindingModel.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jpa.model;
+
+import org.switchyard.component.camel.common.model.consumer.CamelScheduledBatchPollConsumer;
+
+/**
+ * Camel based jpa consumer configuration.
+ *
+ * @author Lukasz Dywicki
+ */
+public interface CamelJpaConsumerBindingModel extends CamelScheduledBatchPollConsumer {
+
+ /**
+ * If true, the entity is deleted after it is consumed; if false, the entity is not deleted.
+ *
+ * @return Should entity be deleted.
+ */
+ Boolean isConsumeDelete();
+
+ /**
+ * Specify delete - or not behavior.
+ *
+ * @param consumeDelete If true entity will be removed after consumption.
+ * @return a reference to this binding model
+ */
+ CamelJpaConsumerBindingModel setConsumeDelete(Boolean consumeDelete);
+
+ /**
+ * Checks if the entity should be locked for processing.
+ *
+ * @return True if lock should be acquired.
+ */
+ Boolean isConsumeLockEntity();
+
+ /**
+ * Specifies whether or not to set an exclusive lock on each entity bean while
+ * processing the results from polling.
+ *
+ * @param consumeLockEntity Should lock be acquired.
+ * @return a reference to this binding model
+ */
+ CamelJpaConsumerBindingModel setConsumeLockEntity(Boolean consumeLockEntity);
+
+ /**
+ * Gets number of maximum results in one query execution.
+ *
+ * @return Limit of query results.
+ */
+ Integer getMaximumResults();
+
+ /**
+ * Set the maximum number of results to retrieve on the Query.
+ *
+ * @param maximumResults Number of maximum results in one poll
+ * @return a reference to this binding model
+ */
+ CamelJpaConsumerBindingModel setMaximumResults(Integer maximumResults);
+
+ /**
+ * Custom query to use when consuming data.
+ *
+ * @return JPA query to use for polling.
+ */
+ String getQuery();
+
+ /**
+ * Specify query to use for polling.
+ *
+ * @param query JPA query.
+ * @return a reference to this binding model
+ */
+ CamelJpaConsumerBindingModel setQuery(String query);
+
+ /**
+ * Named query to use when consuming data.
+ *
+ * @return Named query.
+ */
+ String getNamedQuery();
+
+ /**
+ * Specify named query to use for polling.
+ *
+ * @param namedQuery Named query to use.
+ * @return a reference to this binding model
+ */
+ CamelJpaConsumerBindingModel setNamedQuery(String namedQuery);
+
+ /**
+ * Custom, native and database specific query to use for polling.
+ *
+ * @return SQL query to use.
+ */
+ String getNativeQuery();
+
+ /**
+ * Specify native query to use for polling.
+ *
+ * @param nativeQuery Native query to use.
+ * @return a reference to this binding model
+ */
+ CamelJpaConsumerBindingModel setNativeQuery(String nativeQuery);
+
+ /**
+ * Type of result class.
+ *
+ * @return Class name.
+ */
+ String getResultClass();
+
+ /**
+ * Defines the type of the returned payload. Without this option, we will return
+ * an object array. Only has an affect when using in conjunction with native query
+ * when consuming data.
+ *
+ * @param resultClass Result class used for native call.
+ * @return a reference to this binding model
+ */
+ CamelJpaConsumerBindingModel setResultClass(String resultClass);
+
+ /**
+ * Get the transaction behavior.
+ *
+ * @return True if whole batch should be covered by one transaction.
+ */
+ Boolean isTransacted();
+
+ /**
+ * Whether to run the consumer in transacted mode, by which all messages will
+ * either commit or rollback, when the entire batch has been processed. The default behavior
+ * is to commit all the previously successfully processed messages, and only
+ * rollback the last failed message.
+ *
+ * @param transacted Should whole processing be transactional.
+ * @return a reference to this binding model
+ */
+ CamelJpaConsumerBindingModel setTransacted(Boolean transacted);
+
+}
diff --git a/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/CamelJpaNamespace.java b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/CamelJpaNamespace.java
new file mode 100644
index 000000000..73149b99b
--- /dev/null
+++ b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/CamelJpaNamespace.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jpa.model;
+
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Namespace;
+
+/**
+ * A Camel Jpa config model namespace.
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+public enum CamelJpaNamespace implements Namespace {
+
+ /** The 1.0 namespace. */
+ V_1_0("1.0"),
+ /** The 1.1 namespace. */
+ V_1_1("1.1"),
+ /** The 2.0 namespace. */
+ V_2_0("2.0"),
+ /** The default namespace. */
+ DEFAULT(null);
+
+ private final Util _util;
+
+ /**
+ * Constructs a new CamelJpaNamespace with the specified version.
+ * @param version the specified version, or null to discover the default
+ */
+ CamelJpaNamespace(String version) {
+ _util = new Util(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String section() {
+ return _util.section();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String version() {
+ return _util.version();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean versionMatches(Namespace namespace) {
+ return _util.versionMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String uri() {
+ return _util.uri();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean uriMatches(Namespace namespace) {
+ return _util.uriMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDefault() {
+ return this == DEFAULT || uriMatches(DEFAULT);
+ }
+
+ /**
+ * Gets the CamelJpaNamespace for the specified uri, or null if no matching uris are found.
+ * @param uri the uri
+ * @return the CamelJpaNamespace
+ */
+ public static CamelJpaNamespace fromUri(String uri) {
+ return Util.fromUri(CamelJpaNamespace.class, uri);
+ }
+
+ @SuppressWarnings("serial")
+ private static final class Util extends Namespace.Util {
+ // static final since we only want to do the somewhat expensive work of instantiating this once!
+ private static final Descriptor DESCRIPTOR = new Descriptor(CamelJpaNamespace.class);
+ private Util(String version) {
+ super(DESCRIPTOR, "urn:switchyard-component-camel-jpa:config", version);
+ }
+ }
+
+}
diff --git a/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/CamelJpaProducerBindingModel.java b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/CamelJpaProducerBindingModel.java
new file mode 100644
index 000000000..a0e57d64b
--- /dev/null
+++ b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/CamelJpaProducerBindingModel.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jpa.model;
+
+/**
+ * JPA Producer configuration.
+ *
+ * @author Lukasz Dywicki
+ */
+public interface CamelJpaProducerBindingModel {
+
+ /**
+ * If flush should be executed after persist call.
+ *
+ * @return True if flush should be executed after every store operation.
+ */
+ Boolean isFlushOnSend();
+
+ /**
+ * Flushes the EntityManager after the entity bean has been persisted.
+ *
+ * @param flushOnSend Should flush be executed after every persist/merge.
+ * @return a reference to this binding model
+ */
+ CamelJpaProducerBindingModel setFlushOnSend(Boolean flushOnSend);
+
+ /**
+ * Get the persist flag.
+ *
+ * @return True if persist will be used to store entity.
+ */
+ Boolean isUsePersist();
+
+ /**
+ * Indicates to use entityManager.persist(entity) instead of entityManager.merge(entity).
+ * Note: entityManager.persist(entity) doesn't work for detached entities
+ * (where the EntityManager has to execute an UPDATE instead of an INSERT query)!
+ *
+ * @param usePersist Should camel call persist instead of merge for entities.
+ * @return a reference to this binding model
+ */
+ CamelJpaProducerBindingModel setUsePersist(Boolean usePersist);
+
+}
diff --git a/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaBindingModel.java b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaBindingModel.java
new file mode 100644
index 000000000..3b625268e
--- /dev/null
+++ b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaBindingModel.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jpa.model.v1;
+
+import java.net.URI;
+import java.util.List;
+
+import org.apache.camel.util.UnsafeUriCharactersEncoder;
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelBindingModel;
+import org.switchyard.component.camel.jpa.model.CamelJpaBindingModel;
+import org.switchyard.component.camel.jpa.model.CamelJpaConsumerBindingModel;
+import org.switchyard.component.camel.jpa.model.CamelJpaProducerBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * Implementation of JPA configuration binding model.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V1CamelJpaBindingModel extends V1BaseCamelBindingModel
+ implements CamelJpaBindingModel {
+
+ /**
+ * Camel endpoint type.
+ */
+ public static final String JPA = "jpa";
+
+ private static final String ENTITY_CLASS_NAME = "entityClassName";
+ private static final String PERSISTENCE_UNIT = "persistenceUnit";
+ private static final String TRANSACTION_MANAGER = "transcationManager";
+
+ private CamelJpaConsumerBindingModel _consume;
+ private CamelJpaProducerBindingModel _produce;
+
+ /**
+ * Creates a binding.
+ * @param namespace namespace
+ */
+ public V1CamelJpaBindingModel(String namespace) {
+ super(JPA, namespace);
+
+ setModelChildrenOrder(ENTITY_CLASS_NAME, PERSISTENCE_UNIT, TRANSACTION_MANAGER,
+ CONSUME, PRODUCE);
+ }
+
+ /**
+ * Create a binding from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V1CamelJpaBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ @Override
+ public String getEntityClassName() {
+ return getConfig(ENTITY_CLASS_NAME);
+ }
+
+ @Override
+ public V1CamelJpaBindingModel setEntityClassName(String entityClassName) {
+ return setConfig(ENTITY_CLASS_NAME, entityClassName);
+ }
+
+ @Override
+ public String getPersistenceUnit() {
+ return getConfig(PERSISTENCE_UNIT);
+ }
+
+ @Override
+ public V1CamelJpaBindingModel setPersistenceUnit(String persistenceUnit) {
+ return setConfig(PERSISTENCE_UNIT, persistenceUnit);
+ }
+
+ @Override
+ public String getTransactionManager() {
+ return getConfig(TRANSACTION_MANAGER);
+ }
+
+ @Override
+ public V1CamelJpaBindingModel setTransactionManager(String transactionManager) {
+ return setConfig(TRANSACTION_MANAGER, transactionManager);
+ }
+
+ @Override
+ public CamelJpaConsumerBindingModel getConsumer() {
+ if (_consume == null) {
+ Configuration config = getModelConfiguration().getFirstChild(CONSUME);
+ _consume = new V1CamelJpaConsumerBindingModel(config,
+ getModelDescriptor());
+ }
+ return _consume;
+ }
+
+ @Override
+ public V1CamelJpaBindingModel setConsumer(CamelJpaConsumerBindingModel consumer) {
+ Configuration config = getModelConfiguration().getFirstChild(CONSUME);
+ if (config != null) {
+ // set an existing config value
+ getModelConfiguration().removeChildren(CONSUME);
+ getModelConfiguration().addChild(((V1CamelJpaConsumerBindingModel) consumer)
+ .getModelConfiguration());
+ } else {
+ setChildModel((V1CamelJpaConsumerBindingModel) consumer);
+ }
+ _consume = consumer;
+ return this;
+ }
+
+ @Override
+ public CamelJpaProducerBindingModel getProducer() {
+ if (_produce == null) {
+ Configuration config = getModelConfiguration().getFirstChild(PRODUCE);
+ _produce = new V1CamelJpaProducerBindingModel(config,
+ getModelDescriptor());
+ }
+ return _produce;
+ }
+
+ @Override
+ public V1CamelJpaBindingModel setProducer(CamelJpaProducerBindingModel producer) {
+ Configuration config = getModelConfiguration().getFirstChild(PRODUCE);
+ if (config != null) {
+ // set an existing config value
+ getModelConfiguration().removeChildren(PRODUCE);
+ getModelConfiguration().addChild(((V1CamelJpaProducerBindingModel) producer)
+ .getModelConfiguration());
+ } else {
+ setChildModel((V1CamelJpaProducerBindingModel) producer);
+ }
+ _produce = producer;
+ return this;
+ }
+
+ @Override
+ public URI getComponentURI() {
+ Configuration modelConfiguration = getModelConfiguration();
+ List children = modelConfiguration.getChildren();
+
+ String baseUri = JPA + "://" + getEntityClassName();
+
+ QueryString queryStr = new QueryString();
+ traverseConfiguration(children, queryStr, ENTITY_CLASS_NAME);
+
+ return URI.create(baseUri + UnsafeUriCharactersEncoder.encode(queryStr.toString()));
+ }
+
+}
diff --git a/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaConsumerBindingModel.java b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaConsumerBindingModel.java
new file mode 100644
index 000000000..998e271d6
--- /dev/null
+++ b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaConsumerBindingModel.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jpa.model.v1;
+
+import org.switchyard.component.camel.common.model.v1.V1CamelScheduledBatchPollConsumer;
+import org.switchyard.component.camel.jpa.model.CamelJpaConsumerBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * Implementation of jpa consumer configuration binding.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V1CamelJpaConsumerBindingModel extends V1CamelScheduledBatchPollConsumer
+ implements CamelJpaConsumerBindingModel {
+
+ private static final String CONSUME_DELETE = "consumeDelete";
+ private static final String CONSUME_LOCK_ENTITY = "consumeLockEntity";
+ private static final String MAXIMUM_RESULTS = "maximumResults";
+ private static final String QUERY = "consumer.query";
+ private static final String NAMED_QUERY = "consumer.namedQuery";
+ private static final String NATIVE_QUERY = "consumer.nativeQuery";
+ private static final String RESULT_CLASS = "consumer.resultClass";
+ private static final String TRANSACTED = "consumer.transacted";
+
+ /**
+ * Create a binding from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V1CamelJpaConsumerBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+
+ setModelChildrenOrder(CONSUME_DELETE, CONSUME_LOCK_ENTITY, MAXIMUM_RESULTS, QUERY,
+ NAMED_QUERY, NATIVE_QUERY, RESULT_CLASS, TRANSACTED);
+ }
+
+ /**
+ * Creates new binding model.
+ * @param namespace namespace
+ */
+ public V1CamelJpaConsumerBindingModel(String namespace) {
+ super(namespace, V1CamelJpaBindingModel.CONSUME);
+ }
+
+ @Override
+ public Boolean isConsumeDelete() {
+ return getBooleanConfig(CONSUME_DELETE);
+ }
+
+ @Override
+ public V1CamelJpaConsumerBindingModel setConsumeDelete(Boolean consumeDelete) {
+ return setConfig(CONSUME_DELETE, consumeDelete);
+ }
+
+ @Override
+ public Boolean isConsumeLockEntity() {
+ return getBooleanConfig(CONSUME_LOCK_ENTITY);
+ }
+
+ @Override
+ public V1CamelJpaConsumerBindingModel setConsumeLockEntity(Boolean consumeLockEntity) {
+ return setConfig(CONSUME_LOCK_ENTITY, consumeLockEntity);
+ }
+
+ @Override
+ public Integer getMaximumResults() {
+ return getIntegerConfig(MAXIMUM_RESULTS);
+ }
+
+ @Override
+ public V1CamelJpaConsumerBindingModel setMaximumResults(Integer maximumResults) {
+ return setConfig(MAXIMUM_RESULTS, maximumResults);
+ }
+
+ @Override
+ public String getQuery() {
+ return getConfig(QUERY);
+ }
+
+ @Override
+ public V1CamelJpaConsumerBindingModel setQuery(String query) {
+ return setConfig(QUERY, query);
+ }
+
+ @Override
+ public String getNamedQuery() {
+ return getConfig(NAMED_QUERY);
+ }
+
+ @Override
+ public V1CamelJpaConsumerBindingModel setNamedQuery(String namedQuery) {
+ return setConfig(NAMED_QUERY, namedQuery);
+ }
+
+ @Override
+ public String getNativeQuery() {
+ return getConfig(NATIVE_QUERY);
+ }
+
+ @Override
+ public V1CamelJpaConsumerBindingModel setNativeQuery(String nativeQuery) {
+ return setConfig(NATIVE_QUERY, nativeQuery);
+ }
+
+ @Override
+ public String getResultClass() {
+ return getConfig(RESULT_CLASS);
+ }
+
+ @Override
+ public V1CamelJpaConsumerBindingModel setResultClass(String resultClass) {
+ return setConfig(RESULT_CLASS, resultClass);
+ }
+
+ @Override
+ public Boolean isTransacted() {
+ return getBooleanConfig(TRANSACTED);
+ }
+
+ @Override
+ public V1CamelJpaConsumerBindingModel setTransacted(Boolean transacted) {
+ return setConfig(TRANSACTED, transacted);
+ }
+
+}
diff --git a/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaModelMarshaller.java b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaModelMarshaller.java
new file mode 100644
index 000000000..9c529e23d
--- /dev/null
+++ b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaModelMarshaller.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jpa.model.v1;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelMarshaller;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+import org.switchyard.config.model.composite.BindingModel;
+
+/**
+ * Jpa model marshaller.
+ */
+public class V1CamelJpaModelMarshaller extends V1BaseCamelMarshaller {
+
+ private static final String BINDING_JPA = BindingModel.BINDING + '.' + V1CamelJpaBindingModel.JPA;
+
+ /**
+ * Creates new marshaller.
+ *
+ * @param desc Descriptor
+ */
+ public V1CamelJpaModelMarshaller(Descriptor desc) {
+ super(desc);
+ }
+
+ /**
+ * Reads in the Configuration, looking for various knowledge models.
+ * If not found, it falls back to the super class (V1BaseCamelMarshaller).
+ *
+ * @param config the Configuration
+ * @return the Model
+ */
+ @Override
+ public Model read(Configuration config) {
+ String name = config.getName();
+ Descriptor desc = getDescriptor();
+ if (BINDING_JPA.equals(name)) {
+ return new V1CamelJpaBindingModel(config, desc);
+ }
+ // V1CamelJpaConsumerBindingModel and V1CamelJpaProducerBindingModel get created by V1CamelJpaBindingModel
+ return super.read(config);
+ }
+
+}
diff --git a/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaProducerBindingModel.java b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaProducerBindingModel.java
new file mode 100644
index 000000000..c030eafa3
--- /dev/null
+++ b/components/camel/camel-jpa/src/main/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaProducerBindingModel.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jpa.model.v1;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelModel;
+import org.switchyard.component.camel.jpa.model.CamelJpaProducerBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * Implementation of jpa producer binding model.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V1CamelJpaProducerBindingModel extends V1BaseCamelModel
+ implements CamelJpaProducerBindingModel {
+
+ private static final String FLUS_ON_SEND = "flushOnSend";
+ private static final String USE_PERSIST = "usePersist";
+
+ /**
+ * Create a binding from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V1CamelJpaProducerBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+
+ setModelChildrenOrder(FLUS_ON_SEND, USE_PERSIST);
+ }
+
+ /**
+ * Creates new binding model.
+ * @param namespace namespace
+ */
+ public V1CamelJpaProducerBindingModel(String namespace) {
+ super(namespace, V1CamelJpaBindingModel.PRODUCE);
+ }
+
+ @Override
+ public Boolean isFlushOnSend() {
+ return getBooleanConfig(FLUS_ON_SEND);
+ }
+
+ @Override
+ public V1CamelJpaProducerBindingModel setFlushOnSend(Boolean flushOnSend) {
+ return setConfig(FLUS_ON_SEND, flushOnSend);
+ }
+
+ @Override
+ public Boolean isUsePersist() {
+ return getBooleanConfig(USE_PERSIST);
+ }
+
+ @Override
+ public V1CamelJpaProducerBindingModel setUsePersist(Boolean usePersist) {
+ return setConfig(USE_PERSIST, usePersist);
+ }
+
+}
diff --git a/components/camel/camel-jpa/src/main/resources/META-INF/services/org.switchyard.deploy.Component b/components/camel/camel-jpa/src/main/resources/META-INF/services/org.switchyard.deploy.Component
new file mode 100644
index 000000000..3cd66788b
--- /dev/null
+++ b/components/camel/camel-jpa/src/main/resources/META-INF/services/org.switchyard.deploy.Component
@@ -0,0 +1 @@
+org.switchyard.component.camel.jpa.deploy.CamelJpaComponent
diff --git a/components/camel/camel-jpa/src/main/resources/org/switchyard/component/camel/jpa/model/v1/camel-jpa_1_0.xsd b/components/camel/camel-jpa/src/main/resources/org/switchyard/component/camel/jpa/model/v1/camel-jpa_1_0.xsd
new file mode 100644
index 000000000..36fc9428a
--- /dev/null
+++ b/components/camel/camel-jpa/src/main/resources/org/switchyard/component/camel/jpa/model/v1/camel-jpa_1_0.xsd
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-jpa/src/main/resources/org/switchyard/component/camel/jpa/model/v1/camel-jpa_1_1.xsd b/components/camel/camel-jpa/src/main/resources/org/switchyard/component/camel/jpa/model/v1/camel-jpa_1_1.xsd
new file mode 100644
index 000000000..e5e78dc3a
--- /dev/null
+++ b/components/camel/camel-jpa/src/main/resources/org/switchyard/component/camel/jpa/model/v1/camel-jpa_1_1.xsd
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-jpa/src/main/resources/org/switchyard/component/camel/jpa/model/v2/camel-jpa_2_0.xsd b/components/camel/camel-jpa/src/main/resources/org/switchyard/component/camel/jpa/model/v2/camel-jpa_2_0.xsd
new file mode 100644
index 000000000..5ba912edc
--- /dev/null
+++ b/components/camel/camel-jpa/src/main/resources/org/switchyard/component/camel/jpa/model/v2/camel-jpa_2_0.xsd
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-jpa/src/main/resources/org/switchyard/config/model/descriptor.properties b/components/camel/camel-jpa/src/main/resources/org/switchyard/config/model/descriptor.properties
new file mode 100644
index 000000000..74f53a465
--- /dev/null
+++ b/components/camel/camel-jpa/src/main/resources/org/switchyard/config/model/descriptor.properties
@@ -0,0 +1,32 @@
+# Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+
+camel_jpa_1_0.section=urn:switchyard-component-camel-jpa:config
+camel_jpa_1_0.version=1.0
+camel_jpa_1_0.namespace=urn:switchyard-component-camel-jpa:config:1.0
+camel_jpa_1_0.schema=camel-jpa_1_0.xsd
+camel_jpa_1_0.location=/org/switchyard/component/camel/jpa/model/v1/
+camel_jpa_1_0.marshaller=org.switchyard.component.camel.jpa.model.v1.V1CamelJpaModelMarshaller
+
+camel_jpa_1_1.section=urn:switchyard-component-camel-jpa:config
+camel_jpa_1_1.version=1.1
+camel_jpa_1_1.namespace=urn:switchyard-component-camel-jpa:config:1.1
+camel_jpa_1_1.schema=camel-jpa_1_1.xsd
+camel_jpa_1_1.location=/org/switchyard/component/camel/jpa/model/v1/
+camel_jpa_1_1.marshaller=org.switchyard.component.camel.jpa.model.v1.V1CamelJpaModelMarshaller
+
+camel_jpa_2_0.section=urn:switchyard-component-camel-jpa:config
+camel_jpa_2_0.version=2.0
+camel_jpa_2_0.namespace=urn:switchyard-component-camel-jpa:config:2.0
+camel_jpa_2_0.schema=camel-jpa_2_0.xsd
+camel_jpa_2_0.location=/org/switchyard/component/camel/jpa/model/v2/
+camel_jpa_2_0.marshaller=org.switchyard.component.camel.jpa.model.v1.V1CamelJpaModelMarshaller
diff --git a/components/camel/camel-jpa/src/test/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaBindingModelTest.java b/components/camel/camel-jpa/src/test/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaBindingModelTest.java
new file mode 100644
index 000000000..6404c38a3
--- /dev/null
+++ b/components/camel/camel-jpa/src/test/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaBindingModelTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jpa.model.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.camel.component.jpa.JpaEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.jpa.model.CamelJpaNamespace;
+
+/**
+ * Test for {@link V1CamelJpaBindingModel}.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V1CamelJpaBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-jpa-binding-beans.xml";
+ private static final String CAMEL_URI = "jpa://some.clazz.Name?persistenceUnit=MyPU";
+ static final String ENTITY_CLASS_NAME = "some.clazz.Name";
+ static final String PERSISTENCE_UNIT = "MyPU";
+
+ public V1CamelJpaBindingModelTest() {
+ super(JpaEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V1CamelJpaBindingModel createTestModel() {
+ return new V1CamelJpaBindingModel(CamelJpaNamespace.V_1_0.uri())
+ .setEntityClassName(ENTITY_CLASS_NAME)
+ .setPersistenceUnit(PERSISTENCE_UNIT);
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelJpaBindingModel model) {
+ assertEquals(ENTITY_CLASS_NAME, model.getEntityClassName());
+ assertEquals(PERSISTENCE_UNIT, model.getPersistenceUnit());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-jpa/src/test/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaConsumerBindingModelTest.java b/components/camel/camel-jpa/src/test/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaConsumerBindingModelTest.java
new file mode 100644
index 000000000..fcc16c976
--- /dev/null
+++ b/components/camel/camel-jpa/src/test/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaConsumerBindingModelTest.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jpa.model.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.camel.component.jpa.JpaEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.jpa.model.CamelJpaConsumerBindingModel;
+import org.switchyard.component.camel.jpa.model.CamelJpaNamespace;
+
+/**
+ * Test for {@link V1CamelJpaConsumerBindingModel}.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V1CamelJpaConsumerBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-jpa-binding-consumer-beans.xml";
+
+ private static final String CAMEL_URI = "jpa://some.clazz.Name?persistenceUnit=MyPU&" +
+ "consumeDelete=true&consumeLockEntity=true&maximumResults=10&consumer.query=from User&" +
+ "consumer.namedQuery=fetchUsers&consumer.nativeQuery=select * from users&" +
+ "consumer.resultClass=java.util.ArrayList&consumer.transacted=true";
+
+ private static final Boolean CONSUME_DELETE = true;
+ private static final Boolean CONSUME_LOCK_ENTITY = true;
+ private static final Integer MAXIMUM_RESULTS = 10;
+ private static final String NAMED_QUERY = "fetchUsers";
+ private static final String QUERY = "from User";
+ private static final String NATIVE_QUERY = "select * from users";
+ private static final String RESULT_CLASS = "java.util.ArrayList";
+ private static final Boolean TRANSACTED = true;
+
+ public V1CamelJpaConsumerBindingModelTest() {
+ super(JpaEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V1CamelJpaBindingModel createTestModel() {
+ V1CamelJpaBindingModel model = new V1CamelJpaBindingModel(CamelJpaNamespace.V_1_0.uri());
+ model.setEntityClassName(V1CamelJpaBindingModelTest.ENTITY_CLASS_NAME);
+ model.setPersistenceUnit(V1CamelJpaBindingModelTest.PERSISTENCE_UNIT);
+
+ CamelJpaConsumerBindingModel consumer = (CamelJpaConsumerBindingModel) new V1CamelJpaConsumerBindingModel(CamelJpaNamespace.V_1_0.uri())
+ .setConsumeDelete(CONSUME_DELETE)
+ .setConsumeLockEntity(CONSUME_LOCK_ENTITY)
+ .setMaximumResults(MAXIMUM_RESULTS)
+ .setQuery(QUERY)
+ .setNamedQuery(NAMED_QUERY)
+ .setNativeQuery(NATIVE_QUERY)
+ .setResultClass(RESULT_CLASS)
+ .setTransacted(TRANSACTED);
+ return model.setConsumer(consumer);
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelJpaBindingModel model) {
+ CamelJpaConsumerBindingModel consumer = model.getConsumer();
+ assertEquals(CONSUME_DELETE, consumer.isConsumeDelete());
+ assertEquals(CONSUME_LOCK_ENTITY, consumer.isConsumeLockEntity());
+ assertEquals(MAXIMUM_RESULTS, consumer.getMaximumResults());
+ assertEquals(QUERY, consumer.getQuery());
+ assertEquals(NAMED_QUERY, consumer.getNamedQuery());
+ assertEquals(RESULT_CLASS, consumer.getResultClass());
+ assertEquals(TRANSACTED, consumer.isTransacted());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-jpa/src/test/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaProducerBindingModelTest.java b/components/camel/camel-jpa/src/test/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaProducerBindingModelTest.java
new file mode 100644
index 000000000..89a586ed6
--- /dev/null
+++ b/components/camel/camel-jpa/src/test/java/org/switchyard/component/camel/jpa/model/v1/V1CamelJpaProducerBindingModelTest.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.jpa.model.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.camel.component.jpa.JpaEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelReferenceBindingModelTest;
+import org.switchyard.component.camel.jpa.model.CamelJpaProducerBindingModel;
+import org.switchyard.component.camel.jpa.model.CamelJpaNamespace;
+
+/**
+ * Test for {@link V1CamelJpaProducerBindingModel}.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V1CamelJpaProducerBindingModelTest extends V1BaseCamelReferenceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-jpa-binding-producer-beans.xml";
+
+ private static final String CAMEL_URI = "jpa://some.clazz.Name?persistenceUnit=MyPU&flushOnSend=false&usePersist=false";
+
+ private static final Boolean FLUSH_ON_SEND = false;
+ private static final Boolean USE_PERSIST = false;
+
+ public V1CamelJpaProducerBindingModelTest() {
+ super(JpaEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V1CamelJpaBindingModel createTestModel() {
+ V1CamelJpaBindingModel model = new V1CamelJpaBindingModel(CamelJpaNamespace.V_1_0.uri());
+ model.setEntityClassName(V1CamelJpaBindingModelTest.ENTITY_CLASS_NAME);
+ model.setPersistenceUnit(V1CamelJpaBindingModelTest.PERSISTENCE_UNIT);
+
+ CamelJpaProducerBindingModel producer = new V1CamelJpaProducerBindingModel(CamelJpaNamespace.V_1_0.uri())
+ .setFlushOnSend(FLUSH_ON_SEND)
+ .setUsePersist(USE_PERSIST);
+ return model.setProducer(producer);
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelJpaBindingModel model) {
+ CamelJpaProducerBindingModel producer = model.getProducer();
+ assertEquals(FLUSH_ON_SEND, producer.isFlushOnSend());
+ assertEquals(USE_PERSIST, producer.isUsePersist());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-jpa/src/test/resources/v1/switchyard-jpa-binding-beans.xml b/components/camel/camel-jpa/src/test/resources/v1/switchyard-jpa-binding-beans.xml
new file mode 100644
index 000000000..5be3c548e
--- /dev/null
+++ b/components/camel/camel-jpa/src/test/resources/v1/switchyard-jpa-binding-beans.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+ some.clazz.Name
+ MyPU
+
+
+
+
+
diff --git a/components/camel/camel-jpa/src/test/resources/v1/switchyard-jpa-binding-consumer-beans.xml b/components/camel/camel-jpa/src/test/resources/v1/switchyard-jpa-binding-consumer-beans.xml
new file mode 100644
index 000000000..89ece3111
--- /dev/null
+++ b/components/camel/camel-jpa/src/test/resources/v1/switchyard-jpa-binding-consumer-beans.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+ some.clazz.Name
+ MyPU
+
+ true
+ true
+ 10
+ from User
+ fetchUsers
+ select * from users
+ java.util.ArrayList
+ true
+
+
+
+
+
diff --git a/components/camel/camel-jpa/src/test/resources/v1/switchyard-jpa-binding-producer-beans.xml b/components/camel/camel-jpa/src/test/resources/v1/switchyard-jpa-binding-producer-beans.xml
new file mode 100644
index 000000000..6912cf737
--- /dev/null
+++ b/components/camel/camel-jpa/src/test/resources/v1/switchyard-jpa-binding-producer-beans.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+ some.clazz.Name
+ MyPU
+
+ false
+ false
+
+
+
+
+
diff --git a/components/camel/camel-mail/pom.xml b/components/camel/camel-mail/pom.xml
new file mode 100644
index 000000000..5b46f2f1f
--- /dev/null
+++ b/components/camel/camel-mail/pom.xml
@@ -0,0 +1,56 @@
+
+
+
+ 4.0.0
+
+ org.switchyard.components
+ switchyard-component-camel-parent
+ 2.1.0-SNAPSHOT
+
+ switchyard-component-camel-mail
+ bundle
+ SwitchYard: Camel Component :: Mail Binding
+ http://switchyard.org
+
+
+ org.switchyard.component.camel.mail.*
+
+
+ org.apache.camel.component.mail,
+ org.switchyard.config.model;org.switchyard.*;${switchyard.osgi.import.switchyard.version},
+ *
+
+
+
+
+ org.switchyard.components
+ switchyard-component-common-camel
+
+
+ org.switchyard.components
+ switchyard-component-camel-switchyard
+
+
+ org.apache.camel
+ camel-mail
+ compile
+
+
+ org.switchyard.components
+ switchyard-component-camel-test
+ test
+
+
+
diff --git a/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/deploy/CamelMailComponent.java b/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/deploy/CamelMailComponent.java
new file mode 100644
index 000000000..890c1b0e4
--- /dev/null
+++ b/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/deploy/CamelMailComponent.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.mail.deploy;
+
+import org.switchyard.component.camel.common.deploy.BaseBindingComponent;
+import org.switchyard.component.camel.mail.model.v1.V1CamelMailBindingModel;
+
+/**
+ * Mail binding component.
+ */
+public class CamelMailComponent extends BaseBindingComponent {
+
+ /**
+ * Creates new component.
+ */
+ public CamelMailComponent() {
+ super("CamelMailComponent", V1CamelMailBindingModel.MAIL);
+ }
+
+}
diff --git a/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/CamelMailBindingModel.java b/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/CamelMailBindingModel.java
new file mode 100644
index 000000000..847e506ec
--- /dev/null
+++ b/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/CamelMailBindingModel.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.mail.model;
+
+import org.switchyard.component.camel.common.model.CamelBindingModel;
+
+/**
+ * Represents the configuration settings for an mail endpoint in Camel. Depends
+ * on produce/consume part different protocols will be used.
+ */
+public interface CamelMailBindingModel extends CamelBindingModel {
+
+ /**
+ * The host name or IP address to connect to.
+ *
+ * @return Host name or ip.
+ */
+ String getHost();
+
+ /**
+ * Specify host/ip to use.
+ *
+ * @param host Host or ip address.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailBindingModel setHost(String host);
+
+ /**
+ * The TCP port number to connect on.
+ *
+ * @return TCP port number
+ */
+ Integer getPort();
+
+ /**
+ * Specify TCP port number to connect.
+ *
+ * @param port TCP port to use.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailBindingModel setPort(Integer port);
+
+ /**
+ * The user name on the email server.
+ *
+ * @return User name/login to connect email server.
+ */
+ String getUsername();
+
+ /**
+ * Specify user name to use.
+ *
+ * @param username Username to use for logging in on server.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailBindingModel setUsername(String username);
+
+ /**
+ * The password on the email server.
+ *
+ * @return Password to connect email server.
+ */
+ String getPassword();
+
+ /**
+ * Specify password to use.
+ *
+ * @param password Password for authentication.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailBindingModel setPassword(String password);
+
+ /**
+ * The connection timeout in milliseconds. Default is 30 seconds (30000 millis).
+ *
+ * @return Connection timeout.
+ */
+ Integer getConnectionTimeout();
+
+ /**
+ * Specify connection timeout.
+ *
+ * @param connectionTimeout Connection timeout.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailBindingModel setConnectionTimeout(Integer connectionTimeout);
+
+ /**
+ * Returns the secure flag. In other words if connection should be created
+ * using smtps or smtp protocol scheme.
+ *
+ * @return True if secure connection should be used.
+ */
+ Boolean isSecure();
+
+ /**
+ * Specify if secure connection should be used.
+ *
+ * @param secure True if secure connection should be created.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailBindingModel setSecure(Boolean secure);
+
+ /**
+ * Gets consumer binding attached to this mail binding.
+ *
+ * @return Consumer binding model.
+ */
+ CamelMailConsumerBindingModel getConsumer();
+
+ /**
+ * Specify consumer configuration.
+ *
+ * @param consumer Consumer configuration.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailBindingModel setConsumer(CamelMailConsumerBindingModel consumer);
+
+ /**
+ * Gets producer binding attached to this mail binding.
+ *
+ * @return Producer binding model.
+ */
+ CamelMailProducerBindingModel getProducer();
+
+ /**
+ * Specify producer configuration.
+ *
+ * @param producer Producer configuration.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailBindingModel setProducer(CamelMailProducerBindingModel producer);
+
+}
diff --git a/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/CamelMailConsumerBindingModel.java b/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/CamelMailConsumerBindingModel.java
new file mode 100644
index 000000000..ca6698236
--- /dev/null
+++ b/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/CamelMailConsumerBindingModel.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.mail.model;
+
+import org.switchyard.component.camel.common.model.consumer.CamelScheduledBatchPollConsumer;
+
+/**
+ * Mail consumer/receiver binding model.
+ */
+public interface CamelMailConsumerBindingModel extends CamelScheduledBatchPollConsumer {
+
+ /**
+ * The folder to poll.
+ *
+ * @return Folder name.
+ */
+ String getFolderName();
+
+ /**
+ * Specify folder name to poll.
+ *
+ * @param folderName Folder name to use for polling messages.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailConsumerBindingModel setFolderName(String folderName);
+
+ /**
+ * Sets the maximum number of messages to consume during a poll.
+ *
+ * This can be used to avoid overloading a mail server, if a mailbox folder contains a lot of messages.
+ * Default value of -1 means no fetch size and all messages will be consumed. Setting the value to 0
+ * is a special corner case, where Camel will not consume any messages at all.
+ *
+ * @return Number of messages to read by one connection.
+ */
+ Integer getFetchSize();
+
+ /**
+ * Specify maximum number of messages for one poll.
+ *
+ * @param fetchSize Number of messages to fetch.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailConsumerBindingModel setFetchSize(Integer fetchSize);
+
+ /**
+ * Should camel process only unseen messages (that is, new messages) or all messages.
+ *
+ * Note that Camel always skips deleted messages. The default option of true will filter to only
+ * unseen messages. This setting is applicable only for IMAP.
+ *
+ * @return Should camel use SEEN flag for choosing messages to process.
+ */
+ Boolean isUnseen();
+
+ /**
+ * Specify to use SEEN flag with IMAP or not.
+ *
+ * @param unseen True if camel should process only new (unseen) messages.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailConsumerBindingModel setUnseen(Boolean unseen);
+
+ /**
+ * Deletes the messages after they have been processed.
+ *
+ * @return True if DELETED flag should be set on email after processing.
+ */
+ Boolean isDelete();
+
+ /**
+ * Specify if message should be deleted after processing.
+ *
+ * @param delete True if camel should mark processed messages as deleted.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailConsumerBindingModel setDelete(Boolean delete);
+
+ /**
+ * After processing a mail message, it can be copied to a mail folder with the given name.
+ *
+ * @return Name of folder to copy message after processing.
+ */
+ String getCopyTo();
+
+ /**
+ * Specify folder name to store copies of processed messages.
+ *
+ * @param copyTo Folder name for storing copies.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailConsumerBindingModel setCopyTo(String copyTo);
+
+ /**
+ * Whether the consumer should disconnect after polling. If enabled this forces Camel to connect on each poll.
+ *
+ * @return True if connection should be closed/opened for each poll.
+ */
+ Boolean isDisconnect();
+
+ /**
+ * Specify if connection should be closed after every poll.
+ *
+ * @param disconnect Set to true if connection should be closed after poll.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailConsumerBindingModel setDisconnect(Boolean disconnect);
+
+ /**
+ * Get's protocol - pop3[s] or imap[s].
+ *
+ * @return Protocol to use.
+ */
+ String getProtocol();
+
+ /**
+ * Specify mail server backend type.
+ *
+ * @param accountType Type of server backend. Supported values are IMAP/POP3.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailConsumerBindingModel setAccountType(String accountType);
+
+}
diff --git a/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/CamelMailNamespace.java b/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/CamelMailNamespace.java
new file mode 100644
index 000000000..f8e5cefd1
--- /dev/null
+++ b/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/CamelMailNamespace.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.mail.model;
+
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Namespace;
+
+/**
+ * A Camel Mail config model namespace.
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+public enum CamelMailNamespace implements Namespace {
+
+ /** The 1.0 namespace. */
+ V_1_0("1.0"),
+ /** The 1.1 namespace. */
+ V_1_1("1.1"),
+ /** The 2.0 namespace. */
+ V_2_0("2.0"),
+ /** The default namespace. */
+ DEFAULT(null);
+
+ private final Util _util;
+
+ /**
+ * Constructs a new CamelMailNamespace with the specified version.
+ * @param version the specified version, or null to discover the default
+ */
+ CamelMailNamespace(String version) {
+ _util = new Util(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String section() {
+ return _util.section();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String version() {
+ return _util.version();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean versionMatches(Namespace namespace) {
+ return _util.versionMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String uri() {
+ return _util.uri();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean uriMatches(Namespace namespace) {
+ return _util.uriMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDefault() {
+ return this == DEFAULT || uriMatches(DEFAULT);
+ }
+
+ /**
+ * Gets the CamelMailNamespace for the specified uri, or null if no matching uris are found.
+ * @param uri the uri
+ * @return the CamelMailNamespace
+ */
+ public static CamelMailNamespace fromUri(String uri) {
+ return Util.fromUri(CamelMailNamespace.class, uri);
+ }
+
+ @SuppressWarnings("serial")
+ private static final class Util extends Namespace.Util {
+ // static final since we only want to do the somewhat expensive work of instantiating this once!
+ private static final Descriptor DESCRIPTOR = new Descriptor(CamelMailNamespace.class);
+ private Util(String version) {
+ super(DESCRIPTOR, "urn:switchyard-component-camel-mail:config", version);
+ }
+ }
+
+}
diff --git a/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/CamelMailProducerBindingModel.java b/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/CamelMailProducerBindingModel.java
new file mode 100644
index 000000000..9b4200260
--- /dev/null
+++ b/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/CamelMailProducerBindingModel.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.mail.model;
+
+/**
+ * Mail producer/sender binding model.
+ */
+public interface CamelMailProducerBindingModel {
+
+ /**
+ * Subject of the message being sent.
+ *
+ * @return Mail subject.
+ */
+ String getSubject();
+
+ /**
+ * Specify mail subject to use.
+ *
+ * @param subject Mail subject.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailProducerBindingModel setSubject(String subject);
+
+ /**
+ * The FROM email address.
+ *
+ * @return Sender email address.
+ */
+ String getFrom();
+
+ /**
+ * Specify FROM email address.
+ *
+ * @param from Sender email.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailProducerBindingModel setFrom(String from);
+
+ /**
+ * The TO recipients (the receivers of the mail). Separate multiple email addresses with a comma.
+ *
+ * @return Mail recipients.
+ */
+ String getTo();
+
+ /**
+ * Specify mail recipients.
+ *
+ * @param to Mail recipients.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailProducerBindingModel setTo(String to);
+
+ /**
+ * The CC recipients (the receivers of the mail). Separate multiple email addresses with a comma.
+ *
+ * @return Mail recipients which should receive copy of sent mail.
+ */
+ String getCC();
+
+ /**
+ * Specify mail recipients.
+ *
+ * @param cc Copy recipients.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailProducerBindingModel setCC(String cc);
+
+ /**
+ * The BCC recipients (the receivers of the mail). Separate multiple email addresses with a comma.
+ *
+ * @return Mail recipients which should receive copy of sent mail but stay invisible for others recipients.
+ */
+ String getBCC();
+
+ /**
+ * Specify BCC recipients.
+ *
+ * @param bcc Hidden mail recipients.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailProducerBindingModel setBCC(String bcc);
+
+ /**
+ * The Reply-To recipients (the receivers of the response mail). Separate multiple email addresses with a comma.
+ *
+ * @return Reply to flag for mail.
+ */
+ String getReplyTo();
+
+ /**
+ * Specifies the addresses that should receive an answer for sent mail.
+ *
+ * @param replyTo Reply-to addresses.
+ * @return a reference to this Camel binding model
+ */
+ CamelMailProducerBindingModel setReplyTo(String replyTo);
+
+ /**
+ * Get protocol to use - smpt or smpts.
+ *
+ * @return Protocol to use.
+ */
+ String getProtocol();
+
+}
diff --git a/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailBindingModel.java b/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailBindingModel.java
new file mode 100644
index 000000000..d2a723d16
--- /dev/null
+++ b/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailBindingModel.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.mail.model.v1;
+
+import java.net.URI;
+import java.util.List;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelBindingModel;
+import org.switchyard.component.camel.mail.model.CamelMailBindingModel;
+import org.switchyard.component.camel.mail.model.CamelMailConsumerBindingModel;
+import org.switchyard.component.camel.mail.model.CamelMailProducerBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * First implementation of mail binding.
+ */
+public class V1CamelMailBindingModel extends V1BaseCamelBindingModel
+ implements CamelMailBindingModel {
+
+ /**
+ * Binding name.
+ */
+ public static final String MAIL = "mail";
+
+ private static final String HOST = "host";
+ private static final String PORT = "port";
+ private static final String USERNAME = "username";
+ private static final String PASSWORD = "password";
+ private static final String CONNECTION_TIMEOUT = "connectionTimeout";
+ private static final String SECURE = "secure";
+
+ /**
+ * Mail consumer binding.
+ */
+ private V1CamelMailConsumerBindingModel _consume;
+
+ /**
+ * Mail producer binding.
+ */
+ private V1CamelMailProducerBindingModel _produce;
+
+ /**
+ * Creates new mail binding model.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V1CamelMailBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ /**
+ * Creates new mail binding model.
+ * @param namespace namespace
+ */
+ public V1CamelMailBindingModel(String namespace) {
+ super(MAIL, namespace);
+
+ setModelChildrenOrder(HOST, PORT, USERNAME, PASSWORD, CONNECTION_TIMEOUT,
+ CONSUME, PRODUCE);
+ }
+
+ @Override
+ public String getHost() {
+ return getConfig(HOST);
+ }
+
+ @Override
+ public V1CamelMailBindingModel setHost(String host) {
+ return setConfig(HOST, host);
+ }
+
+ @Override
+ public Integer getPort() {
+ return getIntegerConfig(PORT);
+ }
+
+ @Override
+ public V1CamelMailBindingModel setPort(Integer port) {
+ return setConfig(PORT, port);
+ }
+
+ @Override
+ public String getUsername() {
+ return getConfig(USERNAME);
+ }
+
+ @Override
+ public V1CamelMailBindingModel setUsername(String username) {
+ return setConfig(USERNAME, username);
+ }
+
+ @Override
+ public String getPassword() {
+ return getConfig(PASSWORD);
+ }
+
+ @Override
+ public V1CamelMailBindingModel setPassword(String password) {
+ return setConfig(PASSWORD, password);
+ }
+
+ @Override
+ public Integer getConnectionTimeout() {
+ return getIntegerConfig(CONNECTION_TIMEOUT);
+ }
+
+ @Override
+ public V1CamelMailBindingModel setConnectionTimeout(Integer connectionTimeout) {
+ return setConfig(CONNECTION_TIMEOUT, connectionTimeout);
+ }
+
+ @Override
+ public Boolean isSecure() {
+ return Boolean.valueOf(getModelAttribute(SECURE));
+ }
+
+ @Override
+ public V1CamelMailBindingModel setSecure(Boolean secure) {
+ setModelAttribute(SECURE, Boolean.toString(secure));
+ return this;
+ }
+
+ @Override
+ public V1CamelMailBindingModel setConsumer(CamelMailConsumerBindingModel consumer) {
+ _consume = replaceChildren(CONSUME, (V1CamelMailConsumerBindingModel) consumer);
+ return this;
+ }
+
+ @Override
+ public V1CamelMailConsumerBindingModel getConsumer() {
+ if (_consume == null) {
+ _consume = new V1CamelMailConsumerBindingModel(getFirstChild(CONSUME), getModelDescriptor());
+ }
+ return _consume;
+ }
+
+ @Override
+ public V1CamelMailBindingModel setProducer(CamelMailProducerBindingModel producer) {
+ _produce = replaceChildren(PRODUCE, (V1CamelMailProducerBindingModel) producer);
+ return this;
+ }
+
+ @Override
+ public V1CamelMailProducerBindingModel getProducer() {
+ if (_produce == null) {
+ _produce = new V1CamelMailProducerBindingModel(getFirstChild(PRODUCE), getModelDescriptor());
+ }
+ return _produce;
+ }
+
+ @Override
+ public URI getComponentURI() {
+ Configuration modelConfiguration = getModelConfiguration();
+ List children = modelConfiguration.getChildren();
+
+ QueryString queryString = new QueryString();
+ traverseConfiguration(children, queryString, HOST, PORT);
+
+ String protocol = isReferenceBinding() ? getProducer().getProtocol() : getConsumer().getProtocol();
+ String port = getPort() != null ? ":" + getPort() : "";
+
+ return URI.create(protocol + (isSecure() ? "s" : "") + "://" + getHost() + port + queryString);
+ }
+
+}
diff --git a/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailConsumerBindingModel.java b/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailConsumerBindingModel.java
new file mode 100644
index 000000000..12debf663
--- /dev/null
+++ b/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailConsumerBindingModel.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.mail.model.v1;
+
+import org.switchyard.component.camel.common.model.v1.V1CamelScheduledBatchPollConsumer;
+import org.switchyard.component.camel.mail.model.CamelMailConsumerBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * First implementation of mail consumer/receiver binding.
+ */
+public class V1CamelMailConsumerBindingModel extends V1CamelScheduledBatchPollConsumer
+ implements CamelMailConsumerBindingModel {
+
+ /**
+ * Enumeration type representing supported mail server types.
+ */
+ public enum AccountType {
+ /**
+ * Imap based backend.
+ */
+ imap,
+ /**
+ * POP3 based backend.
+ */
+ pop3;
+ }
+
+ private static final String ACCOUNT_TYPE = "accountType";
+ private static final String FOLDER_NAME = "folderName";
+ private static final String FETCH_SIZE = "fetchSize";
+ private static final String UNSEEN = "unseen";
+ private static final String DELETE = "delete";
+ private static final String COPY_TO = "copyTo";
+ private static final String DISCONNECT = "disconnect";
+
+ /**
+ * Creates new consumer binding model.
+ * @param namespace namespace
+ */
+ public V1CamelMailConsumerBindingModel(String namespace) {
+ super(namespace, V1CamelMailBindingModel.CONSUME);
+
+ setModelChildrenOrder(FOLDER_NAME, FETCH_SIZE, UNSEEN, DELETE, COPY_TO, DISCONNECT);
+ }
+
+ /**
+ * Creates new consumer binding model.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V1CamelMailConsumerBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ @Override
+ public String getFolderName() {
+ return getConfig(FOLDER_NAME);
+ }
+
+ @Override
+ public V1CamelMailConsumerBindingModel setFolderName(String folderName) {
+ return setConfig(FOLDER_NAME, folderName);
+ }
+
+ @Override
+ public Integer getFetchSize() {
+ return getIntegerConfig(FETCH_SIZE);
+ }
+
+ @Override
+ public V1CamelMailConsumerBindingModel setFetchSize(Integer fetchSize) {
+ return setConfig(FETCH_SIZE, fetchSize);
+ }
+
+ @Override
+ public Boolean isUnseen() {
+ return getBooleanConfig(UNSEEN);
+ }
+
+ @Override
+ public V1CamelMailConsumerBindingModel setUnseen(Boolean unseen) {
+ return setConfig(UNSEEN, unseen);
+ }
+
+ @Override
+ public Boolean isDelete() {
+ return getBooleanConfig(DELETE);
+ }
+
+ @Override
+ public V1CamelMailConsumerBindingModel setDelete(Boolean delete) {
+ return setConfig(DELETE, delete);
+ }
+
+ @Override
+ public String getCopyTo() {
+ return getConfig(COPY_TO);
+ }
+
+ @Override
+ public V1CamelMailConsumerBindingModel setCopyTo(String copyTo) {
+ return setConfig(COPY_TO, copyTo);
+ }
+
+ @Override
+ public Boolean isDisconnect() {
+ return getBooleanConfig(DISCONNECT);
+ }
+
+ @Override
+ public V1CamelMailConsumerBindingModel setDisconnect(Boolean disconnect) {
+ return setConfig(DISCONNECT, disconnect);
+ }
+
+ @Override
+ public V1CamelMailConsumerBindingModel setAccountType(String accountType) {
+ setModelAttribute(ACCOUNT_TYPE, accountType);
+ return this;
+ }
+
+ @Override
+ public String getProtocol() {
+ AccountType accountType = getModelConfiguration() != null
+ ? AccountType.valueOf(getModelAttribute(ACCOUNT_TYPE))
+ : AccountType.imap;
+ return accountType.name();
+ }
+
+}
diff --git a/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailModelMarshaller.java b/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailModelMarshaller.java
new file mode 100644
index 000000000..d8d3adefe
--- /dev/null
+++ b/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailModelMarshaller.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.mail.model.v1;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelMarshaller;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+import org.switchyard.config.model.composite.BindingModel;
+
+/**
+ * Mail model marshaller.
+ */
+public class V1CamelMailModelMarshaller extends V1BaseCamelMarshaller {
+
+ private static final String BINDING_MAIL = BindingModel.BINDING + '.' + V1CamelMailBindingModel.MAIL;
+
+ /**
+ * Creates new marshaller.
+ *
+ * @param desc Descriptor
+ */
+ public V1CamelMailModelMarshaller(Descriptor desc) {
+ super(desc);
+ }
+
+ /**
+ * Reads in the Configuration, looking for various knowledge models.
+ * If not found, it falls back to the super class (V1BaseCamelMarshaller).
+ *
+ * @param config the Configuration
+ * @return the Model
+ */
+ @Override
+ public Model read(Configuration config) {
+ String name = config.getName();
+ Descriptor desc = getDescriptor();
+ if (BINDING_MAIL.equals(name)) {
+ return new V1CamelMailBindingModel(config, desc);
+ }
+ // V1CamelMailConsumerBindingModel and V1CamelMailProducerBindingModel get created by V1CamelMailBindingModel
+ return super.read(config);
+ }
+
+}
diff --git a/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailProducerBindingModel.java b/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailProducerBindingModel.java
new file mode 100644
index 000000000..d834f3a3e
--- /dev/null
+++ b/components/camel/camel-mail/src/main/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailProducerBindingModel.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.mail.model.v1;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelModel;
+import org.switchyard.component.camel.mail.model.CamelMailProducerBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * First implementation of mail producer binding.
+ */
+public class V1CamelMailProducerBindingModel extends V1BaseCamelModel
+ implements CamelMailProducerBindingModel {
+
+ /**
+ * Camel endpoint type used for mail producers.
+ */
+ private static final String SMTP = "smtp";
+
+ private static final String SUBJECT = "subject";
+ private static final String FROM = "from";
+ private static final String TO = "to";
+ private static final String CC = "CC";
+ private static final String BCC = "BCC";
+ private static final String REPLY_TO = "replyTo";
+
+ /**
+ * Creates new producer binding model.
+ * @param namespace namespace
+ */
+ public V1CamelMailProducerBindingModel(String namespace) {
+ super(namespace, V1CamelMailBindingModel.PRODUCE);
+ setModelChildrenOrder(SUBJECT, FROM, TO, CC, BCC, REPLY_TO);
+ }
+
+ /**
+ * Creates new producer binding model.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V1CamelMailProducerBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ @Override
+ public String getSubject() {
+ return getConfig(SUBJECT);
+ }
+
+ @Override
+ public V1CamelMailProducerBindingModel setSubject(String subject) {
+ return setConfig(SUBJECT, subject);
+ }
+
+ @Override
+ public String getFrom() {
+ return getConfig(FROM);
+ }
+
+ @Override
+ public V1CamelMailProducerBindingModel setFrom(String from) {
+ return setConfig(FROM, from);
+ }
+
+ @Override
+ public String getTo() {
+ return getConfig(TO);
+ }
+
+ @Override
+ public V1CamelMailProducerBindingModel setTo(String to) {
+ return setConfig(TO, to);
+ }
+
+ @Override
+ public String getCC() {
+ return getConfig(CC);
+ }
+
+ @Override
+ public V1CamelMailProducerBindingModel setCC(String cc) {
+ return setConfig(CC, cc);
+ }
+
+ @Override
+ public String getBCC() {
+ return getConfig(BCC);
+ }
+
+ @Override
+ public V1CamelMailProducerBindingModel setBCC(String bcc) {
+ return setConfig(BCC, bcc);
+ }
+
+ @Override
+ public String getReplyTo() {
+ return getConfig(REPLY_TO);
+ }
+
+ @Override
+ public V1CamelMailProducerBindingModel setReplyTo(String replyTo) {
+ return setConfig(REPLY_TO, replyTo);
+ }
+
+ @Override
+ public String getProtocol() {
+ return SMTP;
+ }
+
+}
diff --git a/components/camel/camel-mail/src/main/resources/META-INF/services/org.switchyard.deploy.Component b/components/camel/camel-mail/src/main/resources/META-INF/services/org.switchyard.deploy.Component
new file mode 100644
index 000000000..133b1610b
--- /dev/null
+++ b/components/camel/camel-mail/src/main/resources/META-INF/services/org.switchyard.deploy.Component
@@ -0,0 +1 @@
+org.switchyard.component.camel.mail.deploy.CamelMailComponent
diff --git a/components/camel/camel-mail/src/main/resources/org/switchyard/component/camel/mail/model/v1/camel-mail_1_0.xsd b/components/camel/camel-mail/src/main/resources/org/switchyard/component/camel/mail/model/v1/camel-mail_1_0.xsd
new file mode 100644
index 000000000..56a9d933d
--- /dev/null
+++ b/components/camel/camel-mail/src/main/resources/org/switchyard/component/camel/mail/model/v1/camel-mail_1_0.xsd
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-mail/src/main/resources/org/switchyard/component/camel/mail/model/v1/camel-mail_1_1.xsd b/components/camel/camel-mail/src/main/resources/org/switchyard/component/camel/mail/model/v1/camel-mail_1_1.xsd
new file mode 100644
index 000000000..178aa0772
--- /dev/null
+++ b/components/camel/camel-mail/src/main/resources/org/switchyard/component/camel/mail/model/v1/camel-mail_1_1.xsd
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-mail/src/main/resources/org/switchyard/component/camel/mail/model/v2/camel-mail_2_0.xsd b/components/camel/camel-mail/src/main/resources/org/switchyard/component/camel/mail/model/v2/camel-mail_2_0.xsd
new file mode 100644
index 000000000..ec54239a3
--- /dev/null
+++ b/components/camel/camel-mail/src/main/resources/org/switchyard/component/camel/mail/model/v2/camel-mail_2_0.xsd
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-mail/src/main/resources/org/switchyard/config/model/descriptor.properties b/components/camel/camel-mail/src/main/resources/org/switchyard/config/model/descriptor.properties
new file mode 100644
index 000000000..7fa81809a
--- /dev/null
+++ b/components/camel/camel-mail/src/main/resources/org/switchyard/config/model/descriptor.properties
@@ -0,0 +1,32 @@
+# Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+
+camel_mail_1_0.section=urn:switchyard-component-camel-mail:config
+camel_mail_1_0.version=1.0
+camel_mail_1_0.namespace=urn:switchyard-component-camel-mail:config:1.0
+camel_mail_1_0.schema=camel-mail_1_0.xsd
+camel_mail_1_0.location=/org/switchyard/component/camel/mail/model/v1/
+camel_mail_1_0.marshaller=org.switchyard.component.camel.mail.model.v1.V1CamelMailModelMarshaller
+
+camel_mail_1_1.section=urn:switchyard-component-camel-mail:config
+camel_mail_1_1.version=1.1
+camel_mail_1_1.namespace=urn:switchyard-component-camel-mail:config:1.1
+camel_mail_1_1.schema=camel-mail_1_1.xsd
+camel_mail_1_1.location=/org/switchyard/component/camel/mail/model/v1/
+camel_mail_1_1.marshaller=org.switchyard.component.camel.mail.model.v1.V1CamelMailModelMarshaller
+
+camel_mail_2_0.section=urn:switchyard-component-camel-mail:config
+camel_mail_2_0.version=2.0
+camel_mail_2_0.namespace=urn:switchyard-component-camel-mail:config:2.0
+camel_mail_2_0.schema=camel-mail_2_0.xsd
+camel_mail_2_0.location=/org/switchyard/component/camel/mail/model/v2/
+camel_mail_2_0.marshaller=org.switchyard.component.camel.mail.model.v1.V1CamelMailModelMarshaller
diff --git a/components/camel/camel-mail/src/test/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailBindingModelTest.java b/components/camel/camel-mail/src/test/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailBindingModelTest.java
new file mode 100644
index 000000000..529723ee3
--- /dev/null
+++ b/components/camel/camel-mail/src/test/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailBindingModelTest.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.mail.model.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.camel.component.mail.MailEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.mail.model.CamelMailNamespace;
+
+/**
+ * Test for {@link V1CamelMailBindingModel}.
+ */
+public class V1CamelMailBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-mail-binding-beans.xml";
+ private static final Boolean SECURE = true;
+
+ private static final String HOST = "localhost";
+ private static final Integer PORT = 233;
+ private static final String USERNAME = "camel";
+ private static final String PASSWORD = "rider";
+ private static final Integer CONNECTION_TIMEOUT = 300;
+ private static final String CAMEL_URI = "imaps://localhost:233?connectionTimeout=300&"
+ + "password=rider&username=camel";
+
+ public V1CamelMailBindingModelTest() {
+ super(MailEndpoint.class, CAMEL_XML);
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelMailBindingModel model) {
+ assertEquals(SECURE, model.isSecure());
+ assertEquals(HOST, model.getHost());
+ assertEquals(PORT, model.getPort());
+ assertEquals(USERNAME, model.getUsername());
+ assertEquals(PASSWORD, model.getPassword());
+ assertEquals(CONNECTION_TIMEOUT, model.getConnectionTimeout());
+ }
+
+ @Override
+ protected V1CamelMailBindingModel createTestModel() {
+ return new V1CamelMailBindingModel(CamelMailNamespace.V_1_0.uri())
+ .setSecure(SECURE)
+ .setHost(HOST)
+ .setPort(PORT)
+ .setUsername(USERNAME)
+ .setPassword(PASSWORD)
+ .setConnectionTimeout(CONNECTION_TIMEOUT)
+ ;
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-mail/src/test/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailConsumerBindingModelTest.java b/components/camel/camel-mail/src/test/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailConsumerBindingModelTest.java
new file mode 100644
index 000000000..49d9ee885
--- /dev/null
+++ b/components/camel/camel-mail/src/test/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailConsumerBindingModelTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.mail.model.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.camel.component.mail.MailEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.mail.model.CamelMailConsumerBindingModel;
+import org.switchyard.component.camel.mail.model.CamelMailNamespace;
+import org.switchyard.component.camel.mail.model.v1.V1CamelMailConsumerBindingModel.AccountType;
+
+/**
+ * Test for {@link V1CamelMailBindingModel} with {@link V1CamelMailConsumerBindingModel} set.
+ */
+public class V1CamelMailConsumerBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-mail-binding-consumer-beans.xml";
+
+ private static final String HOST = "localhost";
+ private static final Boolean SECURE = true;
+
+ private static final String FOLDER_NAME = "Mail/Inbox";
+ private static final Integer FETCH_SIZE = 10;
+ private static final Boolean UNSEEN = false;
+ private static final Boolean DELETE = true;
+ private static final String COPY_TO = "SEEN";
+ private static final Boolean DISCONNECT = true;
+ private static final String ACCOUNT_TYPE = AccountType.pop3.name();
+
+ private static final String CAMEL_URI = "pop3s://localhost?folderName=Mail/Inbox&fetchSize=10&unseen=false&delete=true©To=SEEN&disconnect=true";
+
+ public V1CamelMailConsumerBindingModelTest() {
+ super(MailEndpoint.class, CAMEL_XML);
+ }
+
+ @Override
+ protected V1CamelMailBindingModel createTestModel() {
+ V1CamelMailBindingModel model = new V1CamelMailBindingModel(CamelMailNamespace.V_1_0.uri()) {
+ @Override
+ public boolean isReferenceBinding() {
+ return false;
+ }
+ };
+
+ model.setSecure(SECURE);
+ model.setHost(HOST);
+
+ CamelMailConsumerBindingModel consumer = new V1CamelMailConsumerBindingModel(CamelMailNamespace.V_1_0.uri())
+ .setAccountType(ACCOUNT_TYPE)
+ .setFolderName(FOLDER_NAME)
+ .setFetchSize(FETCH_SIZE)
+ .setUnseen(UNSEEN)
+ .setDelete(DELETE)
+ .setCopyTo(COPY_TO)
+ .setDisconnect(DISCONNECT);
+ model.setConsumer(consumer);
+
+ return model;
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelMailBindingModel model) {
+ assertEquals(HOST, model.getHost());
+ assertEquals(SECURE, model.isSecure());
+
+ V1CamelMailConsumerBindingModel consumer = model.getConsumer();
+ assertEquals(ACCOUNT_TYPE, consumer.getProtocol());
+ assertEquals(FOLDER_NAME, consumer.getFolderName());
+ assertEquals(FETCH_SIZE, consumer.getFetchSize());
+ assertEquals(UNSEEN, consumer.isUnseen());
+ assertEquals(DELETE, consumer.isDelete());
+ assertEquals(COPY_TO, consumer.getCopyTo());
+ assertEquals(DISCONNECT, consumer.isDisconnect());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+}
diff --git a/components/camel/camel-mail/src/test/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailProducerBindingModelTest.java b/components/camel/camel-mail/src/test/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailProducerBindingModelTest.java
new file mode 100644
index 000000000..64a300eb3
--- /dev/null
+++ b/components/camel/camel-mail/src/test/java/org/switchyard/component/camel/mail/model/v1/V1CamelMailProducerBindingModelTest.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.mail.model.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.camel.component.mail.MailEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelReferenceBindingModelTest;
+import org.switchyard.component.camel.mail.model.CamelMailNamespace;
+
+/**
+ * Test for {@link V1CamelMailBindingModel} with {@link V1CamelMailProducerBindingModel} set.
+ */
+public class V1CamelMailProducerBindingModelTest extends V1BaseCamelReferenceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-mail-binding-producer-beans.xml";
+
+ private static final String HOST = "rider";
+ private static final Boolean SECURE = true;
+ private static final String SUBJECT = "Desert ride";
+ private static final String FROM = "rider@camel";
+ private static final String TO = "camel@rider";
+ private static final String CC = "mule@rider";
+ private static final String BCC = "rider@mule";
+ private static final String REPLY_TO = "camel@camel";
+
+ private static final String CAMEL_URI = "smtps://rider?subject=Desert ride&" +
+ "from=rider@camel&to=camel@rider&CC=mule@rider&BCC=rider@mule&replyTo=camel@camel";
+
+ public V1CamelMailProducerBindingModelTest() {
+ super(MailEndpoint.class, CAMEL_XML);
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelMailBindingModel model) {
+ assertEquals(HOST, model.getHost());
+ assertEquals(SECURE, model.isSecure());
+ assertEquals(SUBJECT, model.getProducer().getSubject());
+ assertEquals(FROM, model.getProducer().getFrom());
+ assertEquals(TO, model.getProducer().getTo());
+ assertEquals(CC, model.getProducer().getCC());
+ assertEquals(BCC, model.getProducer().getBCC());
+ assertEquals(REPLY_TO, model.getProducer().getReplyTo());
+ }
+
+ @Override
+ protected V1CamelMailBindingModel createTestModel() {
+ V1CamelMailBindingModel model = new V1CamelMailBindingModel(CamelMailNamespace.V_1_0.uri()) {
+ public boolean isReferenceBinding() {
+ return true;
+ }
+ };
+ model.setSecure(SECURE)
+ .setHost(HOST);
+
+ V1CamelMailProducerBindingModel producer = new V1CamelMailProducerBindingModel(CamelMailNamespace.V_1_0.uri())
+ .setSubject(SUBJECT)
+ .setFrom(FROM)
+ .setTo(TO)
+ .setCC(CC)
+ .setBCC(BCC)
+ .setReplyTo(REPLY_TO);
+
+ return model.setProducer(producer);
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-mail/src/test/resources/v1/switchyard-mail-binding-beans.xml b/components/camel/camel-mail/src/test/resources/v1/switchyard-mail-binding-beans.xml
new file mode 100644
index 000000000..aa8d01e58
--- /dev/null
+++ b/components/camel/camel-mail/src/test/resources/v1/switchyard-mail-binding-beans.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+ localhost
+ 233
+ camel
+ rider
+ 300
+
+
+
+
+
diff --git a/components/camel/camel-mail/src/test/resources/v1/switchyard-mail-binding-consumer-beans.xml b/components/camel/camel-mail/src/test/resources/v1/switchyard-mail-binding-consumer-beans.xml
new file mode 100644
index 000000000..6e518c134
--- /dev/null
+++ b/components/camel/camel-mail/src/test/resources/v1/switchyard-mail-binding-consumer-beans.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+ localhost
+
+ Mail/Inbox
+ 10
+ false
+ true
+ SEEN
+ true
+
+
+
+
+
diff --git a/components/camel/camel-mail/src/test/resources/v1/switchyard-mail-binding-producer-beans.xml b/components/camel/camel-mail/src/test/resources/v1/switchyard-mail-binding-producer-beans.xml
new file mode 100644
index 000000000..6486870f0
--- /dev/null
+++ b/components/camel/camel-mail/src/test/resources/v1/switchyard-mail-binding-producer-beans.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+ rider
+
+ Desert ride
+ rider@camel
+ camel@rider
+ mule@rider
+ rider@mule
+ camel@camel
+
+
+
+
+
+
diff --git a/components/camel/camel-mqtt/pom.xml b/components/camel/camel-mqtt/pom.xml
new file mode 100644
index 000000000..9bcae63b0
--- /dev/null
+++ b/components/camel/camel-mqtt/pom.xml
@@ -0,0 +1,71 @@
+
+
+
+ 4.0.0
+
+ org.switchyard.components
+ switchyard-component-camel-parent
+ 2.1.0-SNAPSHOT
+
+ switchyard-component-camel-mqtt
+ bundle
+ SwitchYard: Camel Component :: MQTT Binding
+ http://switchyard.org
+
+
+ org.switchyard.component.camel.mqtt.*
+
+
+ org.apache.camel.component.mqtt,
+ org.switchyard.config.model;org.switchyard.*;${switchyard.osgi.import.switchyard.version},
+ *
+
+
+
+
+ org.switchyard
+ switchyard-api
+
+
+ org.switchyard
+ switchyard-common
+
+
+ org.switchyard
+ switchyard-common-camel
+
+
+ org.switchyard.components
+ switchyard-component-common-camel
+
+
+ org.switchyard.components
+ switchyard-component-camel-switchyard
+
+
+ org.apache.camel
+ camel-core
+
+
+ org.apache.camel
+ camel-mqtt
+
+
+ org.switchyard.components
+ switchyard-component-camel-test
+ test
+
+
+
diff --git a/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/deploy/CamelMqttActivator.java b/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/deploy/CamelMqttActivator.java
new file mode 100644
index 000000000..9865cc968
--- /dev/null
+++ b/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/deploy/CamelMqttActivator.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.mqtt.deploy;
+
+import javax.xml.namespace.QName;
+
+import org.switchyard.common.camel.SwitchYardCamelContext;
+import org.switchyard.component.camel.common.deploy.BaseBindingActivator;
+import org.switchyard.component.camel.common.handler.InboundHandler;
+import org.switchyard.component.camel.common.model.CamelBindingModel;
+import org.switchyard.component.camel.mqtt.model.CamelMqttBindingModel;
+
+/**
+ * Camel mqtt activator.
+ */
+public class CamelMqttActivator extends BaseBindingActivator {
+
+ /**
+ * Creates new activator instance.
+ *
+ * @param context Camel context.
+ * @param types Activation types.
+ */
+ public CamelMqttActivator(SwitchYardCamelContext context, String[] types) {
+ super(context, types);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected InboundHandler createInboundHandler(QName serviceName, CamelBindingModel binding) {
+ return new CamelMqttInboundHandler((CamelMqttBindingModel)binding, getCamelContext(), serviceName, getServiceDomain());
+ }
+
+}
diff --git a/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/deploy/CamelMqttComponent.java b/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/deploy/CamelMqttComponent.java
new file mode 100644
index 000000000..2dc4ee5a8
--- /dev/null
+++ b/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/deploy/CamelMqttComponent.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.mqtt.deploy;
+
+import org.switchyard.common.camel.SwitchYardCamelContext;
+import org.switchyard.component.camel.common.deploy.BaseBindingActivator;
+import org.switchyard.component.camel.common.deploy.BaseBindingComponent;
+import org.switchyard.component.camel.mqtt.model.v2.V2CamelMqttBindingModel;
+
+/**
+ * MQTT binding component.
+ */
+public class CamelMqttComponent extends BaseBindingComponent {
+
+ /**
+ * Creates new component.
+ */
+ public CamelMqttComponent() {
+ super("CamelMqttComponent", V2CamelMqttBindingModel.MQTT);
+ }
+
+ @Override
+ protected BaseBindingActivator createActivator(SwitchYardCamelContext context, String... types) {
+ return new CamelMqttActivator(context, types);
+ }
+}
diff --git a/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/deploy/CamelMqttInboundHandler.java b/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/deploy/CamelMqttInboundHandler.java
new file mode 100644
index 000000000..84bd8fa92
--- /dev/null
+++ b/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/deploy/CamelMqttInboundHandler.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.mqtt.deploy;
+
+import javax.xml.namespace.QName;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.model.RouteDefinition;
+import org.switchyard.ServiceDomain;
+import org.switchyard.common.camel.SwitchYardCamelContext;
+import org.switchyard.common.type.Classes;
+import org.switchyard.component.camel.common.CamelConstants;
+import org.switchyard.component.camel.common.handler.InboundHandler;
+import org.switchyard.component.camel.common.handler.MessageComposerProcessor;
+import org.switchyard.component.camel.common.handler.OperationSelectorProcessor;
+import org.switchyard.component.camel.mqtt.model.CamelMqttBindingModel;
+import org.switchyard.runtime.event.ExchangeCompletionEvent;
+
+/**
+ * Inbound handler for MQTT binding. Set applicationContextClassLoader in CamelContext as a TCCL
+ * as MQTT consumer runs with other class loader, causes issues. See https://issues.jboss.org/browse/SWITCHYARD-2220
+ */
+public class CamelMqttInboundHandler extends InboundHandler {
+
+ private static final String ORIGINAL_CLASS_LOADER = "org.switchyard.component.camel.mqtt.deploy.CamelMqttInboundHandler.originalClassLoader";
+
+ /**
+ * Sole constructor.
+ *
+ * @param camelBindingModel The CamelBindingModel.
+ * @param camelContext The camel context instance.
+ * @param serviceName The target service name.
+ * @param domain the service domain.
+ */
+ public CamelMqttInboundHandler(CamelMqttBindingModel camelBindingModel,
+ SwitchYardCamelContext camelContext, QName serviceName, ServiceDomain domain) {
+ super(camelBindingModel, camelContext, serviceName, domain);
+ }
+
+ @Override
+ protected RouteDefinition createRouteDefinition() {
+ final RouteDefinition route = new RouteDefinition();
+ route.routeId(getRouteId()).from(getComponentUri().toString());
+ addTransactionPolicy(route)
+ .doTry()
+ // SWITCHYARD-2220 - MQTT consumer needs TCCL to be set manually
+ .process(new Processor() {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ ClassLoader appClassLoader = exchange.getContext().getApplicationContextClassLoader();
+ ClassLoader origCl = Classes.setTCCL(appClassLoader);
+ exchange.setProperty(ORIGINAL_CLASS_LOADER, origCl);
+ }
+ })
+ .setProperty(ExchangeCompletionEvent.GATEWAY_NAME).simple(getBindingModel().getName(), String.class)
+ .setProperty(CamelConstants.APPLICATION_NAMESPACE).constant(getServiceName().getNamespaceURI())
+ .process(new MessageComposerProcessor(getBindingModel()))
+ .process(new OperationSelectorProcessor(getServiceName(), getBindingModel()))
+ .to(getSwitchyardEndpointUri())
+ .doFinally()
+ .process(new Processor() {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ ClassLoader origCl = exchange.getProperty(ORIGINAL_CLASS_LOADER, ClassLoader.class);
+ if (origCl != null) {
+ Classes.setTCCL(origCl);
+ }
+ }
+ });
+ return route;
+ }
+
+}
diff --git a/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/model/CamelMqttBindingModel.java b/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/model/CamelMqttBindingModel.java
new file mode 100644
index 000000000..e12e27134
--- /dev/null
+++ b/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/model/CamelMqttBindingModel.java
@@ -0,0 +1,320 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.mqtt.model;
+
+import org.switchyard.component.camel.common.model.CamelBindingModel;
+
+/**
+ * Configuration binding for mqtt.
+ *
+ * @author Douglas Palmer
+ */
+public interface CamelMqttBindingModel extends CamelBindingModel {
+
+ /** Camel endpoint type. */
+ String MQTT = "mqtt";
+
+ /**
+ * Gets name.
+ *
+ * @return name
+ */
+ String getName();
+
+ /**
+ * Sets name.
+ *
+ * @param name name
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setName(String name);
+
+ /**
+ * Gets host name / ip.
+ *
+ * @return Host name.
+ */
+ String getHost();
+
+ /**
+ * Sets host name.
+ *
+ * @param host Host name.
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setHost(String host);
+
+ /**
+ * Gets local address.
+ *
+ * @return local address
+ */
+ String getLocalAddress();
+
+ /**
+ * Sets local address.
+ * @param localAddress local address
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setLocalAddress(String localAddress);
+
+ /**
+ * Gets connectAttemptsMax.
+ *
+ * @return connectAttemptsMax
+ */
+ Integer getConnectAttemptsMax();
+
+ /**
+ * Sets the maximum number of connect attempts.
+ *
+ * @param connectAttemptsMax Maximum number of connect attempts.
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setConnectAttemptsMax(int connectAttemptsMax);
+
+ /**
+ * Gets reconnectAttemptsMax.
+ *
+ * @return reconnectAttemptsMax
+ */
+ Integer getReconnectAttemptsMax();
+
+ /**
+ * Sets the maximum number of reconnect attempts.
+ *
+ * @param reconnectAttemptsMax Maximum number of reconnect attempts.
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setReconnectAttemptsMax(int reconnectAttemptsMax);
+
+ /**
+ * Gets reconnect delay.
+ *
+ * @return reconnectDelay
+ */
+ Integer getReconnectDelay();
+
+ /**
+ * Sets the delay between reconnects.
+ *
+ * @param reconnectDelay the time between reconnect attempts.
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setReconnectDelay(int reconnectDelay);
+
+ /**
+ * Gets multiplier for incremental backoff between reconnect attempts.
+ *
+ * @return reconnectBackOffMultiplier
+ */
+ Double getReconnectBackOffMultiplier();
+
+ /**
+ * Sets the multiplier for incremental backoff between reconnect attempts.
+ *
+ * @param reconnectBackOffMultiplier the multiplier for incremental backoff between reconnect attempts.
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setReconnectBackOffMultiplier(double reconnectBackOffMultiplier);
+
+ /**
+ * Gets the maximum reconnect delay.
+ *
+ * @return reconnectDelayMax
+ */
+ Integer getReconnectDelayMax();
+
+ /**
+ * Sets the maximum delay between reconnects.
+ *
+ * @param reconnectDelayMax the maximum time between reconnect attempts.
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setReconnectDelayMax(int reconnectDelayMax);
+
+ /**
+ * Gets user name.
+ * @return user name
+ */
+ String getUserName();
+
+ /**
+ * Sets user name.
+ * @param username user name
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setUserName(String username);
+
+ /**
+ * Gets password.
+ * @return password
+ */
+ String getPassword();
+
+ /**
+ * Sets password.
+ * @param password password
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setPassword(String password);
+
+ /**
+ * Gets quality of service.
+ *
+ * @return quality of service
+ */
+ String getQualityOfService();
+
+ /**
+ * Sets quality of service.
+ * @param qualityOfService quality of service
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setQualityOfService(String qualityOfService);
+
+ /**
+ * Gets subscribe topic name.
+ * @return subscribe topic name
+ */
+ String getSubscribeTopicName();
+
+ /**
+ * Sets subscribe topic name.
+ *
+ * @param subscribeTopicName subscribe topic name
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setSubscribeTopicName(String subscribeTopicName);
+
+ /**
+ * Gets publish topic name.
+ *
+ * @return publish topic name
+ */
+ String getPublishTopicName();
+
+ /**
+ * Sets publish topic name.
+ * @param publishTopicName publish topic name
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setPublishTopicName(String publishTopicName);
+
+ /**
+ * Retain messages by default - on/off.
+ *
+ * @return True if messages should be retained by default.
+ */
+ Boolean isByDefaultRetain();
+
+ /**
+ * Setting to specify whether messages should be retained by default.
+ *
+ * @param byDefaultRetain Should messages be retained by default.
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setByDefaultRetain(Boolean byDefaultRetain);
+
+ /**
+ * Gets mqtt topic property name.
+ *
+ * @return topic property name
+ */
+ String getMqttTopicPropertyName();
+
+ /**
+ * Sets mqtt topic property name.
+ *
+ * @param mqttTopicPropertyName topic property name
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setMqttTopicPropertyName(String mqttTopicPropertyName);
+
+ /**
+ * Gets mqtt retain property name.
+ *
+ * @return retain property name
+ */
+ String getMqttRetainPropertyName();
+
+ /**
+ * Sets mqtt retain property name.
+ *
+ * @param mqttRetainPropertyName retain property name
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setMqttRetainPropertyName(String mqttRetainPropertyName);
+
+ /**
+ * Gets mqtt QoS property name.
+ *
+ * @return QoS property name
+ */
+ String getMqttQosPropertyName();
+
+ /**
+ * Sets mqtt QoS property name.
+ *
+ * @param mqttQosPropertyName QoS property name
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setMqttQosPropertyName(String mqttQosPropertyName);
+
+ /**
+ * Gets connect wait in seconds.
+ *
+ * @return connect wait in seconds
+ */
+ Integer getConnectWaitInSeconds();
+
+ /**
+ * Sets connect wait in seconds.
+ *
+ * @param connectWaitInSeconds connect wait in seconds
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setConnectWaitInSeconds(int connectWaitInSeconds);
+
+ /**
+ * Gets disconnect wait in seconds.
+ *
+ * @return disconnect wait in seconds
+ */
+ Integer getDisconnectWaitInSeconds();
+
+ /**
+ * Sets disconnect wait in seconds.
+ *
+ * @param disconnectWaitInSeconds disconnect wait in seconds
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setDisonnectWaitInSeconds(int disconnectWaitInSeconds);
+
+ /**
+ * Gets send wait in seconds.
+ *
+ * @return send wait in seconds
+ */
+ Integer getSendWaitInSeconds();
+
+ /**
+ * Sets send wait in seconds.
+ *
+ * @param sendWaitInSeconds send wait in seconds
+ * @return a reference to this binding model
+ */
+ CamelMqttBindingModel setSendWaitInSeconds(int sendWaitInSeconds);
+
+}
diff --git a/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/model/CamelMqttNamespace.java b/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/model/CamelMqttNamespace.java
new file mode 100644
index 000000000..e15ae555d
--- /dev/null
+++ b/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/model/CamelMqttNamespace.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.mqtt.model;
+
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Namespace;
+
+/**
+ * A Camel MQTT config model namespace.
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+public enum CamelMqttNamespace implements Namespace {
+
+ /** The 1.0 namespace. */
+ V_1_0("1.0"),
+ /** The 1.1 namespace. */
+ V_1_1("1.1"),
+ /** The 2.0 namespace. */
+ V_2_0("2.0"),
+ /** The default namespace. */
+ DEFAULT(null);
+
+ private final Util _util;
+
+ /**
+ * Constructs a new CamelMqttNamespace with the specified version.
+ * @param version the specified version, or null to discover the default
+ */
+ CamelMqttNamespace(String version) {
+ _util = new Util(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String section() {
+ return _util.section();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String version() {
+ return _util.version();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean versionMatches(Namespace namespace) {
+ return _util.versionMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String uri() {
+ return _util.uri();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean uriMatches(Namespace namespace) {
+ return _util.uriMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDefault() {
+ return this == DEFAULT || uriMatches(DEFAULT);
+ }
+
+ /**
+ * Gets the CamelMqttNamespace for the specified uri, or null if no matching uris are found.
+ * @param uri the uri
+ * @return the CamelMqttNamespace
+ */
+ public static CamelMqttNamespace fromUri(String uri) {
+ return Util.fromUri(CamelMqttNamespace.class, uri);
+ }
+
+ @SuppressWarnings("serial")
+ private static final class Util extends Namespace.Util {
+ // static final since we only want to do the somewhat expensive work of instantiating this once!
+ private static final Descriptor DESCRIPTOR = new Descriptor(CamelMqttNamespace.class);
+ private Util(String version) {
+ super(DESCRIPTOR, "urn:switchyard-component-camel-mqtt:config", version);
+ }
+ }
+
+}
diff --git a/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/model/v2/V2CamelMqttBindingModel.java b/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/model/v2/V2CamelMqttBindingModel.java
new file mode 100644
index 000000000..1f178a3d4
--- /dev/null
+++ b/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/model/v2/V2CamelMqttBindingModel.java
@@ -0,0 +1,288 @@
+package org.switchyard.component.camel.mqtt.model.v2;
+
+import java.net.URI;
+import java.util.List;
+
+import org.apache.camel.util.UnsafeUriCharactersEncoder;
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelBindingModel;
+import org.switchyard.component.camel.mqtt.model.CamelMqttBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * V2 CamelMqttBindingModel.
+ */
+public class V2CamelMqttBindingModel extends V1BaseCamelBindingModel implements CamelMqttBindingModel {
+
+ /** QoS enum. */
+ public enum QualityOfService {
+ /** at most once. */
+ AtMostOnce,
+ /** at least once. */
+ AtLeastOnce,
+ /** exactly once. */
+ ExactlyOnce;
+ }
+
+ private static final String NAME = "name";
+ private static final String HOST = "host";
+ private static final String LOCAL_ADDRESS = "localAddress";
+ private static final String CONNECT_ATTEMPTS_MAX = "connectAttemptsMax";
+ private static final String RECONNECT_ATTEMPTS_MAX = "reconnectAttemptsMax";
+ private static final String RECONNECT_DELAY = "reconnectDelay";
+ private static final String RECONNECT_BACK_OFF_MULTIPLIER = "reconnectBackOffMultiplier";
+ private static final String RECONNECT_DELAY_MAX = "reconnectDelayMax";
+ private static final String USER_NAME = "userName";
+ private static final String PASSWORD = "password";
+ private static final String QUALITY_OF_SERVICE = "qualityOfService";
+ private static final String SUBSCRIBE_TOPIC_NAME = "subscribeTopicName";
+ private static final String PUBLISH_TOPIC_NAME = "publishTopicName";
+ private static final String BY_DEFAULT_RETAIN = "byDefaultRetain";
+ private static final String MQTT_TOPIC_PROPERTY_NAME = "mqttTopicPropertyName";
+ private static final String MQTT_RETAIN_PROPERTY_NAME = "mqttRetainPropertyName";
+ private static final String MQTT_QOS_PROPERTY_NAME = "mqttQosPropertyName";
+ private static final String CONNECT_WAIT_IN_SECONDS = "connectWaitInSeconds";
+ private static final String DISCONNECT_WAIT_IN_SECONDS = "disconnectWaitInSeconds";
+ private static final String SEND_WAIT_IN_SECONDS = "sendWaitInSeconds";
+
+ /**
+ * Creates new mqtt binding model.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V2CamelMqttBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ /**
+ * Creates new mqtt binding model.
+ * @param namespace namespace
+ */
+ public V2CamelMqttBindingModel(String namespace) {
+ super(MQTT, namespace);
+
+ setModelChildrenOrder(NAME, HOST, LOCAL_ADDRESS, CONNECT_ATTEMPTS_MAX, RECONNECT_ATTEMPTS_MAX, RECONNECT_DELAY, RECONNECT_BACK_OFF_MULTIPLIER, RECONNECT_DELAY_MAX,
+ USER_NAME, PASSWORD, QUALITY_OF_SERVICE, SUBSCRIBE_TOPIC_NAME, PUBLISH_TOPIC_NAME, BY_DEFAULT_RETAIN, MQTT_TOPIC_PROPERTY_NAME, MQTT_RETAIN_PROPERTY_NAME,
+ MQTT_QOS_PROPERTY_NAME, CONNECT_WAIT_IN_SECONDS, DISCONNECT_WAIT_IN_SECONDS, SEND_WAIT_IN_SECONDS);
+ }
+
+ @Override
+ public String getName() {
+ return getModelAttribute(NAME);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setName(String name) {
+ setModelAttribute(NAME, name);
+ return this;
+ }
+
+ @Override
+ public String getHost() {
+ return getConfig(HOST);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setHost(String host) {
+ return setConfig(HOST, host);
+ }
+
+ @Override
+ public String getLocalAddress() {
+ return getConfig(LOCAL_ADDRESS);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setLocalAddress(String localAddress) {
+ return setConfig(LOCAL_ADDRESS, localAddress);
+ }
+
+ @Override
+ public Integer getConnectAttemptsMax() {
+ return getIntegerConfig(CONNECT_ATTEMPTS_MAX);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setConnectAttemptsMax(int connectAttemptsMax) {
+ return setConfig(CONNECT_ATTEMPTS_MAX, connectAttemptsMax);
+ }
+
+ @Override
+ public Integer getReconnectAttemptsMax() {
+ return getIntegerConfig(RECONNECT_ATTEMPTS_MAX);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setReconnectAttemptsMax(int reconnectAttemptsMax) {
+ return setConfig(RECONNECT_ATTEMPTS_MAX, reconnectAttemptsMax);
+ }
+
+ @Override
+ public Integer getReconnectDelay() {
+ return getIntegerConfig(RECONNECT_DELAY);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setReconnectDelay(int reconnectDelay) {
+ return setConfig(RECONNECT_DELAY, reconnectDelay);
+ }
+
+ @Override
+ public Double getReconnectBackOffMultiplier() {
+ return getDoubleConfig(RECONNECT_BACK_OFF_MULTIPLIER);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setReconnectBackOffMultiplier(double reconnectBackOffMultiplier) {
+ return setConfig(RECONNECT_BACK_OFF_MULTIPLIER, reconnectBackOffMultiplier);
+ }
+
+ @Override
+ public Integer getReconnectDelayMax() {
+ return getIntegerConfig(RECONNECT_DELAY_MAX);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setReconnectDelayMax(int reconnectDelayMax) {
+ return setConfig(RECONNECT_DELAY_MAX, reconnectDelayMax);
+ }
+
+ @Override
+ public String getUserName() {
+ return getConfig(USER_NAME);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setUserName(String username) {
+ return setConfig(USER_NAME, username);
+ }
+
+ @Override
+ public String getPassword() {
+ return getConfig(PASSWORD);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setPassword(String password) {
+ return setConfig(PASSWORD, password);
+ }
+
+ @Override
+ public String getQualityOfService() {
+ QualityOfService qualityOfService = getModelConfiguration() != null
+ ? QualityOfService.valueOf(getConfig(QUALITY_OF_SERVICE))
+ : QualityOfService.AtLeastOnce;
+ return qualityOfService.name();
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setQualityOfService(String qualityOfService) {
+ return setConfig(QUALITY_OF_SERVICE, qualityOfService);
+ }
+
+ @Override
+ public String getSubscribeTopicName() {
+ return getConfig(SUBSCRIBE_TOPIC_NAME);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setSubscribeTopicName(String subscribeTopicName) {
+ return setConfig(SUBSCRIBE_TOPIC_NAME, subscribeTopicName);
+ }
+
+ @Override
+ public String getPublishTopicName() {
+ return getConfig(PUBLISH_TOPIC_NAME);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setPublishTopicName(String publishTopicName) {
+ return setConfig(PUBLISH_TOPIC_NAME, publishTopicName);
+ }
+
+ @Override
+ public Boolean isByDefaultRetain() {
+ return getBooleanConfig(BY_DEFAULT_RETAIN);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setByDefaultRetain(Boolean byDefaultRetain) {
+ return setConfig(BY_DEFAULT_RETAIN, byDefaultRetain);
+ }
+
+ @Override
+ public String getMqttTopicPropertyName() {
+ return getConfig(MQTT_TOPIC_PROPERTY_NAME);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setMqttTopicPropertyName(String mqttTopicPropertyName) {
+ return setConfig(MQTT_TOPIC_PROPERTY_NAME, mqttTopicPropertyName);
+ }
+
+ @Override
+ public String getMqttRetainPropertyName() {
+ return getConfig(MQTT_RETAIN_PROPERTY_NAME);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setMqttRetainPropertyName(String mqttRetainPropertyName) {
+ return setConfig(MQTT_RETAIN_PROPERTY_NAME, mqttRetainPropertyName);
+ }
+
+ @Override
+ public String getMqttQosPropertyName() {
+ return getConfig(MQTT_QOS_PROPERTY_NAME);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setMqttQosPropertyName(String mqttQosPropertyName) {
+ return setConfig(MQTT_QOS_PROPERTY_NAME, mqttQosPropertyName);
+ }
+
+ @Override
+ public Integer getConnectWaitInSeconds() {
+ return getIntegerConfig(CONNECT_WAIT_IN_SECONDS);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setConnectWaitInSeconds(int connectWaitInSeconds) {
+ return setConfig(CONNECT_WAIT_IN_SECONDS, connectWaitInSeconds);
+ }
+
+ @Override
+ public Integer getDisconnectWaitInSeconds() {
+ return getIntegerConfig(DISCONNECT_WAIT_IN_SECONDS);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setDisonnectWaitInSeconds(int disconnectWaitInSeconds) {
+ return setConfig(DISCONNECT_WAIT_IN_SECONDS, disconnectWaitInSeconds);
+ }
+
+ @Override
+ public Integer getSendWaitInSeconds() {
+ return getIntegerConfig(SEND_WAIT_IN_SECONDS);
+ }
+
+ @Override
+ public V2CamelMqttBindingModel setSendWaitInSeconds(int sendWaitInSeconds) {
+ return setConfig(SEND_WAIT_IN_SECONDS, sendWaitInSeconds);
+ }
+
+ @Override
+ public URI getComponentURI() {
+ Configuration modelConfiguration = getModelConfiguration();
+ List children = modelConfiguration.getChildren();
+
+ String baseUri = MQTT + "://" + getName();
+
+ QueryString queryStr = new QueryString();
+ traverseConfiguration(children, queryStr, NAME);
+
+ return URI.create(UnsafeUriCharactersEncoder.encode(baseUri + queryStr.toString()));
+ }
+
+}
diff --git a/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/model/v2/V2CamelMqttModelMarshaller.java b/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/model/v2/V2CamelMqttModelMarshaller.java
new file mode 100644
index 000000000..717c2aadd
--- /dev/null
+++ b/components/camel/camel-mqtt/src/main/java/org/switchyard/component/camel/mqtt/model/v2/V2CamelMqttModelMarshaller.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.mqtt.model.v2;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelMarshaller;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+import org.switchyard.config.model.composite.BindingModel;
+
+/**
+ * Mqtt model marshaller.
+ */
+public class V2CamelMqttModelMarshaller extends V1BaseCamelMarshaller {
+
+ private static final String BINDING_MQTT = BindingModel.BINDING + '.' + V2CamelMqttBindingModel.MQTT;
+
+ /**
+ * Creates new marshaller.
+ *
+ * @param desc Descriptor
+ */
+ public V2CamelMqttModelMarshaller(Descriptor desc) {
+ super(desc);
+ }
+
+ /**
+ * Reads in the Configuration, looking for various knowledge models.
+ * If not found, it falls back to the super class (V1BaseCamelMarshaller).
+ *
+ * @param config the Configuration
+ * @return the Model
+ */
+ @Override
+ public Model read(Configuration config) {
+ String name = config.getName();
+ Descriptor desc = getDescriptor();
+ if (BINDING_MQTT.equals(name)) {
+ return new V2CamelMqttBindingModel(config, desc);
+ }
+ return super.read(config);
+ }
+
+}
diff --git a/components/camel/camel-mqtt/src/main/resources/META-INF/services/org.switchyard.deploy.Component b/components/camel/camel-mqtt/src/main/resources/META-INF/services/org.switchyard.deploy.Component
new file mode 100644
index 000000000..250abd75c
--- /dev/null
+++ b/components/camel/camel-mqtt/src/main/resources/META-INF/services/org.switchyard.deploy.Component
@@ -0,0 +1 @@
+org.switchyard.component.camel.mqtt.deploy.CamelMqttComponent
diff --git a/components/camel/camel-mqtt/src/main/resources/org/switchyard/component/camel/mqtt/model/v2/camel-mqtt_2_0.xsd b/components/camel/camel-mqtt/src/main/resources/org/switchyard/component/camel/mqtt/model/v2/camel-mqtt_2_0.xsd
new file mode 100644
index 000000000..5477a50f4
--- /dev/null
+++ b/components/camel/camel-mqtt/src/main/resources/org/switchyard/component/camel/mqtt/model/v2/camel-mqtt_2_0.xsd
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-mqtt/src/main/resources/org/switchyard/config/model/descriptor.properties b/components/camel/camel-mqtt/src/main/resources/org/switchyard/config/model/descriptor.properties
new file mode 100644
index 000000000..1e1a1e55e
--- /dev/null
+++ b/components/camel/camel-mqtt/src/main/resources/org/switchyard/config/model/descriptor.properties
@@ -0,0 +1,18 @@
+# Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+
+camel_mqtt_2_0.section=urn:switchyard-component-camel-mqtt:config
+camel_mqtt_2_0.version=2.0
+camel_mqtt_2_0.namespace=urn:switchyard-component-camel-mqtt:config:2.0
+camel_mqtt_2_0.schema=camel-mqtt_2_0.xsd
+camel_mqtt_2_0.location=/org/switchyard/component/camel/mqtt/model/v2/
+camel_mqtt_2_0.marshaller=org.switchyard.component.camel.mqtt.model.v2.V2CamelMqttModelMarshaller
diff --git a/components/camel/camel-mqtt/src/test/java/org/switchyard/component/camel/mqtt/model/v2/V2CamelMqttBindingModelTest.java b/components/camel/camel-mqtt/src/test/java/org/switchyard/component/camel/mqtt/model/v2/V2CamelMqttBindingModelTest.java
new file mode 100644
index 000000000..7a52adb7c
--- /dev/null
+++ b/components/camel/camel-mqtt/src/test/java/org/switchyard/component/camel/mqtt/model/v2/V2CamelMqttBindingModelTest.java
@@ -0,0 +1,101 @@
+package org.switchyard.component.camel.mqtt.model.v2;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.camel.component.mqtt.MQTTEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.mqtt.model.CamelMqttNamespace;
+import org.switchyard.component.camel.mqtt.model.v2.V2CamelMqttBindingModel.QualityOfService;
+
+public class V2CamelMqttBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String NAME = "Garfield";
+ private static final String HOST = "tcp://127.0.0.1:1883";
+ private static final String LOCAL_ADDRESS = "tcp://127.0.0.1:1883";
+ private static final Integer CONNECT_ATTEMPTS_MAX = 10;
+ private static final Integer RECONNECT_ATTEMPTS_MAX = 10;
+ private static final Integer RECONNECT_DELAY = 10;
+ private static final Double RECONNECT_BACK_OFF_MULTIPLIER = 5.0;
+ private static final Integer RECONNECT_DELAY_MAX = 100;
+ private static final String USER_NAME = "karaf";
+ private static final String PASSWORD = "karaf";
+ private static final String QUALITY_OF_SERVICE = QualityOfService.ExactlyOnce.name();
+ private static final String SUBSCRIBE_TOPIC_NAME = "camel/mqtt/test";
+ private static final String PUBLISH_TOPIC_NAME = "camel/mqtt/test";
+ private static final Boolean BY_DEFAULT_RETAIN = true;
+ private static final String MQTT_TOPIC_PROPERTY_NAME = "MQTT_TOPIC";
+ private static final String MQTT_RETAIN_PROPERTY_NAME = "MQTT_RETAIN";
+ private static final String MQTT_QOS_PROPERTY_NAME = "MQTT_QOS";
+ private static final Integer CONNECT_WAIT_IN_SECONDS = 10;
+ private static final Integer DISCONNECT_WAIT_IN_SECONDS = 10;
+ private static final Integer SEND_WAIT_IN_SECONDS = 10;
+
+ private static final String CAMEL_XML = "/v2/switchyard-mqtt-binding-beans.xml";
+ private static final String CAMEL_URI = "mqtt://" + NAME + "?host=" + HOST + "&localAddress=" + LOCAL_ADDRESS + "&connectAttemptsMax=" + CONNECT_ATTEMPTS_MAX
+ + "&reconnectAttemptsMax=" + RECONNECT_ATTEMPTS_MAX + "&reconnectDelay=" + RECONNECT_DELAY + "&reconnectBackOffMultiplier=" + RECONNECT_BACK_OFF_MULTIPLIER
+ + "&reconnectDelayMax=" + RECONNECT_DELAY_MAX + "&userName=" + USER_NAME + "&password=" + PASSWORD + "&qualityOfService=" + QUALITY_OF_SERVICE
+ + "&subscribeTopicName=" + SUBSCRIBE_TOPIC_NAME + "&publishTopicName=" + PUBLISH_TOPIC_NAME + "&byDefaultRetain=" + BY_DEFAULT_RETAIN
+ + "&mqttTopicPropertyName=" + MQTT_TOPIC_PROPERTY_NAME + "&mqttRetainPropertyName=" + MQTT_RETAIN_PROPERTY_NAME
+ + "&mqttQosPropertyName=" + MQTT_QOS_PROPERTY_NAME + "&connectWaitInSeconds=" + CONNECT_WAIT_IN_SECONDS
+ + "&disconnectWaitInSeconds=" + DISCONNECT_WAIT_IN_SECONDS + "&sendWaitInSeconds=" + SEND_WAIT_IN_SECONDS;
+
+ public V2CamelMqttBindingModelTest () {
+ super(MQTTEndpoint.class, CAMEL_XML);
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected void createModelAssertions(V2CamelMqttBindingModel model) {
+ assertEquals(NAME, model.getName());
+ assertEquals(HOST, model.getHost());
+ assertEquals(LOCAL_ADDRESS, model.getLocalAddress());
+ assertEquals(CONNECT_ATTEMPTS_MAX, model.getConnectAttemptsMax());
+ assertEquals(RECONNECT_ATTEMPTS_MAX, model.getReconnectAttemptsMax());
+ assertEquals(RECONNECT_DELAY, model.getReconnectDelay());
+ assertEquals(RECONNECT_BACK_OFF_MULTIPLIER, model.getReconnectBackOffMultiplier());
+ assertEquals(RECONNECT_DELAY_MAX, model.getReconnectDelayMax());
+ assertEquals(USER_NAME, model.getUserName());
+ assertEquals(PASSWORD, model.getPassword());
+ assertEquals(QUALITY_OF_SERVICE, model.getQualityOfService());
+ assertEquals(SUBSCRIBE_TOPIC_NAME, model.getSubscribeTopicName());
+ assertEquals(PUBLISH_TOPIC_NAME, model.getPublishTopicName());
+ assertEquals(BY_DEFAULT_RETAIN, model.isByDefaultRetain());
+ assertEquals(MQTT_TOPIC_PROPERTY_NAME, model.getMqttTopicPropertyName());
+ assertEquals(MQTT_RETAIN_PROPERTY_NAME, model.getMqttRetainPropertyName());
+ assertEquals(MQTT_QOS_PROPERTY_NAME, model.getMqttQosPropertyName());
+ assertEquals(CONNECT_WAIT_IN_SECONDS, model.getConnectWaitInSeconds());
+ assertEquals(DISCONNECT_WAIT_IN_SECONDS, model.getDisconnectWaitInSeconds());
+ assertEquals(SEND_WAIT_IN_SECONDS, model.getSendWaitInSeconds());
+ }
+
+ @Override
+ protected V2CamelMqttBindingModel createTestModel() {
+ return new V2CamelMqttBindingModel(CamelMqttNamespace.V_2_0.uri())
+ .setName(NAME)
+ .setHost(HOST)
+ .setLocalAddress(LOCAL_ADDRESS)
+ .setConnectAttemptsMax(CONNECT_ATTEMPTS_MAX)
+ .setReconnectAttemptsMax(RECONNECT_ATTEMPTS_MAX)
+ .setReconnectDelay(RECONNECT_DELAY)
+ .setReconnectBackOffMultiplier(RECONNECT_BACK_OFF_MULTIPLIER)
+ .setReconnectDelayMax(RECONNECT_DELAY_MAX)
+ .setUserName(USER_NAME)
+ .setPassword(PASSWORD)
+ .setQualityOfService(QUALITY_OF_SERVICE)
+ .setSubscribeTopicName(SUBSCRIBE_TOPIC_NAME)
+ .setPublishTopicName(PUBLISH_TOPIC_NAME)
+ .setByDefaultRetain(BY_DEFAULT_RETAIN)
+ .setMqttTopicPropertyName(MQTT_TOPIC_PROPERTY_NAME)
+ .setMqttRetainPropertyName(MQTT_RETAIN_PROPERTY_NAME)
+ .setMqttQosPropertyName(MQTT_QOS_PROPERTY_NAME)
+ .setConnectWaitInSeconds(CONNECT_WAIT_IN_SECONDS)
+ .setDisonnectWaitInSeconds(DISCONNECT_WAIT_IN_SECONDS)
+ .setSendWaitInSeconds(SEND_WAIT_IN_SECONDS);
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-mqtt/src/test/resources/v2/switchyard-mqtt-binding-beans.xml b/components/camel/camel-mqtt/src/test/resources/v2/switchyard-mqtt-binding-beans.xml
new file mode 100644
index 000000000..8761ede19
--- /dev/null
+++ b/components/camel/camel-mqtt/src/test/resources/v2/switchyard-mqtt-binding-beans.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+ tcp://127.0.0.1:1883
+ tcp://127.0.0.1:1883
+ 10
+ 10
+ 10
+ 5.0
+ 100
+ karaf
+ karaf
+ ExactlyOnce
+ camel/mqtt/test
+ camel/mqtt/test
+ true
+ MQTT_TOPIC
+ MQTT_RETAIN
+ MQTT_QOS
+ 10
+ 10
+ 10
+
+
+
+
+
diff --git a/components/camel/camel-netty/pom.xml b/components/camel/camel-netty/pom.xml
new file mode 100644
index 000000000..40671dd8d
--- /dev/null
+++ b/components/camel/camel-netty/pom.xml
@@ -0,0 +1,72 @@
+
+
+
+ 4.0.0
+
+ org.switchyard.components
+ switchyard-component-camel-parent
+ 2.1.0-SNAPSHOT
+
+ switchyard-component-camel-netty
+ bundle
+ SwitchYard: Camel Component :: Netty Binding
+ http://switchyard.org
+
+
+ org.switchyard.component.camel.netty.*
+
+
+ org.apache.camel.component.netty,
+ org.switchyard.config.model;org.switchyard.*;${switchyard.osgi.import.switchyard.version},
+ org.jboss.netty.*;version="[3,4)",
+ *
+
+
+
+
+ org.switchyard
+ switchyard-security
+
+
+ org.switchyard.components
+ switchyard-component-common
+
+
+ org.switchyard.components
+ switchyard-component-common-camel
+
+
+ org.switchyard.components
+ switchyard-component-camel-switchyard
+
+
+ org.apache.camel
+ camel-core
+
+
+ org.apache.camel
+ camel-netty
+
+
+ io.netty
+ netty
+
+
+ org.switchyard.components
+ switchyard-component-camel-test
+ test
+
+
+
diff --git a/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/deploy/CamelNettyComponent.java b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/deploy/CamelNettyComponent.java
new file mode 100644
index 000000000..46dfb7f0a
--- /dev/null
+++ b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/deploy/CamelNettyComponent.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.netty.deploy;
+
+import org.switchyard.component.camel.common.deploy.BaseBindingComponent;
+import org.switchyard.component.camel.netty.model.v1.V1CamelNettyTcpBindingModel;
+import org.switchyard.component.camel.netty.model.v1.V1CamelNettyUdpBindingModel;
+
+/**
+ * Netty tcp & udp binding component.
+ */
+public class CamelNettyComponent extends BaseBindingComponent {
+
+ /**
+ * Creates new component.
+ */
+ public CamelNettyComponent() {
+ super("CamelNettyComponent", V1CamelNettyTcpBindingModel.TCP, V1CamelNettyUdpBindingModel.UDP);
+ }
+
+}
diff --git a/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/CamelNettyBindingModel.java b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/CamelNettyBindingModel.java
new file mode 100644
index 000000000..fa013f843
--- /dev/null
+++ b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/CamelNettyBindingModel.java
@@ -0,0 +1,332 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.netty.model;
+
+import org.switchyard.component.camel.common.model.CamelBindingModel;
+import org.switchyard.component.camel.netty.model.v1.V1CamelNettyBindingModel;
+
+/**
+ * Configuration binding for netty.
+ *
+ * @author Lukasz Dywicki
+ */
+public interface CamelNettyBindingModel extends CamelBindingModel {
+
+ /**
+ * Gets host name / ip.
+ *
+ * @return Host name.
+ */
+ String getHost();
+
+ /**
+ * Sets host name.
+ *
+ * @param host Host name.
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setHost(String host);
+
+ /**
+ * Gets connection port.
+ *
+ * @return Port number used to connect remote server.
+ */
+ Integer getPort();
+
+ /**
+ * Sets port to use during connection.
+ *
+ * @param port Port number.
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setPort(int port);
+
+ /**
+ * The TCP/UDP buffer sizes to be used during inbound communication. Size is bytes.
+ *
+ * @return Inbound buffer size.
+ */
+ Long getReceiveBufferSize();
+
+ /**
+ * Specify inbound buffer size.
+ *
+ * @param receiveBufferSize Buffer size.
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setReceiveBufferSize(Long receiveBufferSize);
+
+ /**
+ * The TCP/UDP buffer sizes to be used during outbound communication. Size is bytes.
+ *
+ * @return Outbound buffer size.
+ */
+ Long getSendBufferSize();
+
+ /**
+ * Specify outbound buffer size.
+ *
+ * @param sendBufferSize Buffer size.
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setSendBufferSize(Long sendBufferSize);
+
+ /**
+ * SSL status - on/off.
+ *
+ * @return True if ssl is enabled for endpoint.
+ */
+ Boolean isSsl();
+
+ /**
+ * Setting to specify whether SSL encryption is applied to this endpoint.
+ *
+ * @param ssl Should ssl be used.
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setSsl(Boolean ssl);
+
+ /**
+ * Return name of bean instance used as ssl handler.
+ *
+ * @return Custom ssl handler bean name.
+ */
+ String getSslHandler();
+
+ /**
+ * Sets sslHandler bean name..
+ *
+ * @param sslHandler Name of bean used as ssl handler.
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setSslHandler(String sslHandler);
+
+ /**
+ * Indicates whether client authentication will be performed for SSL connections.
+ * @return true if client auth will be performed, false otherwise
+ */
+ public Boolean isNeedClientAuth();
+
+ /**
+ * Specifies whether client authentication should be performed as part of an
+ * SSL exchange.
+ * @param needClientAuth true to enable client authentication, false to disable
+ * @return a reference to this binding model
+ */
+ public V1CamelNettyBindingModel setNeedClientAuth(Boolean needClientAuth);
+
+ /**
+ * Password bean used to access keystore.
+ *
+ * @return Keystore password bean reference.
+ */
+ String getPassphrase();
+
+ /**
+ * Specify keystore password.
+ *
+ * @param passphrase Password.
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setPassphrase(String passphrase);
+
+ /**
+ * Returns security provider name. By default SunX509 is used.
+ *
+ * @return Security provider name.
+ */
+ String getSecurityProvider();
+
+ /**
+ * Specify security provider name.
+ *
+ * @param securityProvider Name of JSSE provider.
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setSecurityProvider(String securityProvider);
+
+ /**
+ * Returns keystore format. By default JKS is used.
+ *
+ * @return Keystore format.
+ */
+ String getKeyStoreFormat();
+
+ /**
+ * Specify keystore format.
+ *
+ * @param keyStoreFormat Format of the keystore.
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setKeyStoreFormat(String keyStoreFormat);
+
+ /**
+ * Returns name of bean pointing to keystore file.
+ *
+ * @return Kestore bean name.
+ */
+ String getKeyStoreFile();
+
+ /**
+ * Specify keystore file name.
+ *
+ * @param keyStoreFile Keystore file bean name.
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setKeyStoreFile(String keyStoreFile);
+
+ /**
+ * Returns name of bean pointing to truststore file.
+ *
+ * @return Truststore bean name.
+ */
+ String getTrustStoreFile();
+
+ /**
+ * Specify truststore file name.
+ *
+ * @param trustStoreFile Name of truststore bean.
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setTrustStoreFile(String trustStoreFile);
+
+ /**
+ * Gets bean reference name representing SSLContextParameters.
+ *
+ * @return Bean reference name.
+ */
+ String getSslContextParametersRef();
+
+ /**
+ * Specify SSL context parameters reference name.
+ *
+ * @param sslContextParametersRef Name of bean used to retrieve all SSL related settings.
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setSslContextParametersRef(String sslContextParametersRef);
+
+ /**
+ * Socket multiplexing.
+ *
+ * @return True if multiplexing is turned on.
+ */
+ Boolean isReuseAddress();
+
+ /**
+ * Setting to facilitate socket multiplexing.
+ *
+ * @param reuseAddress Reuse address.
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setReuseAddress(Boolean reuseAddress);
+
+ /**
+ * Encoders list containing ChannelDownStreamHandler implementations.
+ *
+ * @return Bean name in registry
+ */
+ String getEncoders();
+
+ /**
+ * A list of encoder to be used. You can use a String which have values separated by comma,
+ * and have the values be looked up in the Registry. Just remember to prefix the value with
+ * # so Camel knows it should look.
+ *
+ * @param encoders Name of list in registry.
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setEncoders(String encoders);
+
+ /**
+ * Encoders list containing ChannelUpStreamHandler implementations.
+ *
+ * @return Bean name in registry.
+ */
+ String getDecoders();
+
+ /**
+ * A list of decorder to be used. You can use a String which have values separated by comma,
+ * and have the values be looked up in the Registry. Just remember to prefix the value with
+ * # so Camel knows it should lookup.
+ *
+ * @param decoders Name of list in registry.
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setDecoders(String decoders);
+
+ /**
+ * Should default codec chanin be used?
+ *
+ * @return True to let netty rely on defaults.
+ */
+ Boolean isAllowDefaultCodec();
+
+ /**
+ * The netty component installs a default codec if both, encoder/deocder is null and textline is false.
+ * Setting allowDefaultCodec to false prevents the netty component from installing a default codec
+ * as the first element in the filter chain.
+ *
+ * @param allowDefaultCodec Turn on or off default encoder/decoder chain.
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setAllowDefaultCodec(Boolean allowDefaultCodec);
+
+ /**
+ * Number of workers to run.
+ *
+ * @return Number of workers.
+ */
+ Integer getWorkerCount();
+
+ /**
+ * When netty works on nio mode, it uses default workerCount parameter from Netty, which is cpu_core_threads*2.
+ * User can use this operation to override the default workerCount from Netty.
+ *
+ * @param workerCount Number of workers.
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setWorkerCount(Integer workerCount);
+
+ /**
+ * Flag to identify in-out or in only endpoint.
+ *
+ * @return True if endpoint is in-out.
+ */
+ Boolean isSync();
+
+ /**
+ * Setting to set endpoint as one-way or request-response.
+ *
+ * @param sync Should communication be bidirectional or not?
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setSync(Boolean sync);
+
+ /**
+ * Disconnect after operation.
+ *
+ * @return True if connection should be closed after use.
+ */
+ Boolean isDisconnect();
+
+ /**
+ * Whether or not to disconnect(close) from Netty Channel right after use.
+ *
+ * @param disconnect Close connection after operation.
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setDisconnect(Boolean disconnect);
+
+}
diff --git a/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/CamelNettyNamespace.java b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/CamelNettyNamespace.java
new file mode 100644
index 000000000..5185ebcab
--- /dev/null
+++ b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/CamelNettyNamespace.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.netty.model;
+
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Namespace;
+
+/**
+ * A Camel Netty config model namespace.
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+public enum CamelNettyNamespace implements Namespace {
+
+ /** The 1.0 namespace. */
+ V_1_0("1.0"),
+ /** The 1.1 namespace. */
+ V_1_1("1.1"),
+ /** The 2.0 namespace. */
+ V_2_0("2.0"),
+ /** The default namespace. */
+ DEFAULT(null);
+
+ private final Util _util;
+
+ /**
+ * Constructs a new CamelNettyNamespace with the specified version.
+ * @param version the specified version, or null to discover the default
+ */
+ CamelNettyNamespace(String version) {
+ _util = new Util(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String section() {
+ return _util.section();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String version() {
+ return _util.version();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean versionMatches(Namespace namespace) {
+ return _util.versionMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String uri() {
+ return _util.uri();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean uriMatches(Namespace namespace) {
+ return _util.uriMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDefault() {
+ return this == DEFAULT || uriMatches(DEFAULT);
+ }
+
+ /**
+ * Gets the CamelNettyNamespace for the specified uri, or null if no matching uris are found.
+ * @param uri the uri
+ * @return the CamelNettyNamespace
+ */
+ public static CamelNettyNamespace fromUri(String uri) {
+ return Util.fromUri(CamelNettyNamespace.class, uri);
+ }
+
+ @SuppressWarnings("serial")
+ private static final class Util extends Namespace.Util {
+ // static final since we only want to do the somewhat expensive work of instantiating this once!
+ private static final Descriptor DESCRIPTOR = new Descriptor(CamelNettyNamespace.class);
+ private Util(String version) {
+ super(DESCRIPTOR, "urn:switchyard-component-camel-netty:config", version);
+ }
+ }
+
+}
diff --git a/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/CamelNettyTcpBindingModel.java b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/CamelNettyTcpBindingModel.java
new file mode 100644
index 000000000..7c01df1c8
--- /dev/null
+++ b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/CamelNettyTcpBindingModel.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.netty.model;
+
+/**
+ * Configuration binding for tcp gateway.
+ *
+ * @author Lukasz Dywicki
+ */
+public interface CamelNettyTcpBindingModel extends CamelNettyBindingModel {
+
+ /**
+ * Mode of endpoint - binary or text based.
+ *
+ * @return True if text is chosen.
+ */
+ Boolean isTextline();
+
+ /**
+ * If no codec is specified, you can use this flag to indicate a text line based codec;
+ * if not specified or the value is false, then Object Serialization is assumed over TCP.
+ *
+ * @param textline True to use text based communication.
+ * @return a reference to this binding model
+ */
+ CamelNettyTcpBindingModel setTextline(Boolean textline);
+
+ /**
+ * TCP_NO_DELAY Flag for socket.
+ *
+ * @return True if flag should be set.
+ */
+ Boolean isTcpNoDelay();
+
+ /**
+ * Setting to improve TCP protocol performance.
+ *
+ * @param tcpNoDelay True if you willing to set TCP_NO_DELAY on socket.
+ * @return a reference to this binding model
+ */
+ CamelNettyTcpBindingModel setTcpNoDelay(Boolean tcpNoDelay);
+
+ /**
+ * Should socket be keept open?
+ *
+ * @return True to keep socket open.
+ */
+ Boolean isKeepAlive();
+
+ /**
+ * Setting to ensure socket is not closed due to inactivity.
+ *
+ * @param keepAlive True to keep socket open.
+ * @return a reference to this binding model
+ */
+ CamelNettyTcpBindingModel setKeepAlive(Boolean keepAlive);
+
+}
diff --git a/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/CamelNettyUdpBindingModel.java b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/CamelNettyUdpBindingModel.java
new file mode 100644
index 000000000..eab930e0d
--- /dev/null
+++ b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/CamelNettyUdpBindingModel.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.netty.model;
+
+/**
+ * Configuration binding for tcp gateway.
+ *
+ * @author Lukasz Dywicki
+ */
+public interface CamelNettyUdpBindingModel extends CamelNettyBindingModel {
+
+ /**
+ * Get type of UDP transmission - broadcast or multicast.
+ *
+ * @return True if broadcast should be used.
+ */
+ Boolean isBroadcast();
+
+ /**
+ * Setting to choose broadcast over UDP.
+ *
+ * @param broadcast Use broadcast instead of multicast
+ * @return a reference to this binding model
+ */
+ CamelNettyBindingModel setBroadcast(Boolean broadcast);
+
+}
diff --git a/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/v1/V1CamelNettyBindingModel.java b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/v1/V1CamelNettyBindingModel.java
new file mode 100644
index 000000000..0a11e1219
--- /dev/null
+++ b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/v1/V1CamelNettyBindingModel.java
@@ -0,0 +1,293 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.netty.model.v1;
+
+import java.net.URI;
+import java.util.List;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelBindingModel;
+import org.switchyard.component.camel.netty.model.CamelNettyBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * Implementation of netty binding.
+ *
+ * @author Lukasz Dywicki
+ */
+public abstract class V1CamelNettyBindingModel extends V1BaseCamelBindingModel
+ implements CamelNettyBindingModel {
+
+ /**
+ * Camel component prefix.
+ */
+ public static final String NETTY = "netty";
+
+ private static final String HOST = "host";
+ private static final String PORT = "port";
+ private static final String RECEIVE_BUFFER_SIZE = "receiveBufferSize";
+ private static final String SEND_BUFFER_SIZE = "sendBufferSize";
+ private static final String SSL = "ssl";
+ private static final String SSL_HANDLER = "sslHandler";
+ private static final String NEED_CLIENT_AUTH = "needClientAuth";
+ private static final String PASSPHRASE = "passphrase";
+ private static final String SECURITY_PROVIDER = "securityProvider";
+ private static final String KEY_STORE_FORMAT = "keyStoreFormat";
+ private static final String KEY_STORE_FILE = "keyStoreFile";
+ private static final String TRUST_STORE_FILE = "trustStoreFile";
+ private static final String SSL_CONTEXT_PARAMETERS_REF = "sslContextParametersRef";
+ private static final String REUSE_ADDRESS = "reuseAddress";
+ private static final String ENCODERS = "encoders";
+ private static final String DECODERS = "decoders";
+ private static final String ALLOW_DEFAULT_CODEC = "allowDefaultCodec";
+ private static final String WORKER_COUNT = "workerCount";
+ private static final String SYNC = "sync";
+ private static final String DISCONNECT = "disconnect";
+
+ /**
+ * Create a V1CamelNettyBindingModel from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ protected V1CamelNettyBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ protected V1CamelNettyBindingModel(String namespace, String name) {
+ super(namespace, name);
+
+ setModelChildrenOrder(HOST, PORT, RECEIVE_BUFFER_SIZE, SEND_BUFFER_SIZE,
+ SSL, SSL_HANDLER, NEED_CLIENT_AUTH, PASSPHRASE, SECURITY_PROVIDER, KEY_STORE_FORMAT,
+ KEY_STORE_FILE, TRUST_STORE_FILE, SSL_CONTEXT_PARAMETERS_REF, REUSE_ADDRESS,
+ ENCODERS, DECODERS, ALLOW_DEFAULT_CODEC, WORKER_COUNT, SYNC, DISCONNECT);
+ }
+
+ @Override
+ public String getHost() {
+ return getConfig(HOST);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setHost(String host) {
+ return setConfig(HOST, host);
+ }
+
+ @Override
+ public Integer getPort() {
+ return getIntegerConfig(PORT);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setPort(int port) {
+ return setConfig(PORT, port);
+ }
+
+ @Override
+ public Long getReceiveBufferSize() {
+ return getLongConfig(RECEIVE_BUFFER_SIZE);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setReceiveBufferSize(Long receiveBufferSize) {
+ return setConfig(RECEIVE_BUFFER_SIZE, receiveBufferSize);
+ }
+
+ @Override
+ public Long getSendBufferSize() {
+ return getLongConfig(SEND_BUFFER_SIZE);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setSendBufferSize(Long sendBufferSize) {
+ return setConfig(SEND_BUFFER_SIZE, sendBufferSize);
+ }
+
+ @Override
+ public Boolean isSsl() {
+ return getBooleanConfig(SSL);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setSsl(Boolean ssl) {
+ return setConfig(SSL, ssl);
+ }
+
+ @Override
+ public String getSslHandler() {
+ return getConfig(SSL_HANDLER);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setSslHandler(String sslHandler) {
+ return setConfig(SSL_HANDLER, sslHandler);
+ }
+
+ @Override
+ public Boolean isNeedClientAuth() {
+ return getBooleanConfig(NEED_CLIENT_AUTH);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setNeedClientAuth(Boolean needClientAuth) {
+ return setConfig(NEED_CLIENT_AUTH, needClientAuth);
+ }
+
+ @Override
+ public String getPassphrase() {
+ return getConfig(PASSPHRASE);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setPassphrase(String passphrase) {
+ return setConfig(PASSPHRASE, passphrase);
+ }
+
+ @Override
+ public String getSecurityProvider() {
+ return getConfig(SECURITY_PROVIDER);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setSecurityProvider(String securityProvider) {
+ return setConfig(SECURITY_PROVIDER, securityProvider);
+ }
+
+ @Override
+ public String getKeyStoreFormat() {
+ return getConfig(KEY_STORE_FORMAT);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setKeyStoreFormat(String keyStoreFormat) {
+ return setConfig(KEY_STORE_FORMAT, keyStoreFormat);
+ }
+
+ @Override
+ public String getKeyStoreFile() {
+ return getConfig(KEY_STORE_FILE);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setKeyStoreFile(String keyStoreFile) {
+ return setConfig(KEY_STORE_FILE, keyStoreFile);
+ }
+
+ @Override
+ public String getTrustStoreFile() {
+ return getConfig(TRUST_STORE_FILE);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setTrustStoreFile(String trustStoreFile) {
+ return setConfig(TRUST_STORE_FILE, trustStoreFile);
+ }
+
+ @Override
+ public String getSslContextParametersRef() {
+ return getConfig(SSL_CONTEXT_PARAMETERS_REF);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setSslContextParametersRef(String sslContextParametersRef) {
+ return setConfig(SSL_CONTEXT_PARAMETERS_REF, sslContextParametersRef);
+ }
+
+ @Override
+ public Boolean isReuseAddress() {
+ return getBooleanConfig(REUSE_ADDRESS);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setReuseAddress(Boolean reuseAddress) {
+ return setConfig(REUSE_ADDRESS, reuseAddress);
+ }
+
+ @Override
+ public String getEncoders() {
+ return getConfig(ENCODERS);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setEncoders(String encoders) {
+ return setConfig(ENCODERS, encoders);
+ }
+
+ @Override
+ public String getDecoders() {
+ return getConfig(DECODERS);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setDecoders(String decoders) {
+ return setConfig(DECODERS, decoders);
+ }
+
+ @Override
+ public Boolean isAllowDefaultCodec() {
+ return getBooleanConfig(ALLOW_DEFAULT_CODEC);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setAllowDefaultCodec(Boolean allowDefaultCodec) {
+ return setConfig(ALLOW_DEFAULT_CODEC, allowDefaultCodec);
+ }
+
+ @Override
+ public Integer getWorkerCount() {
+ return getIntegerConfig(WORKER_COUNT);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setWorkerCount(Integer workerCount) {
+ return setConfig(WORKER_COUNT, workerCount);
+ }
+
+ @Override
+ public Boolean isSync() {
+ return getBooleanConfig(SYNC);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setSync(Boolean sync) {
+ return setConfig(SYNC, sync);
+ }
+
+ @Override
+ public Boolean isDisconnect() {
+ return getBooleanConfig(DISCONNECT);
+ }
+
+ @Override
+ public V1CamelNettyBindingModel setDisconnect(Boolean disconnect) {
+ return setConfig(DISCONNECT, disconnect);
+ }
+
+ protected abstract String getProtocol();
+
+ @Override
+ public URI getComponentURI() {
+ Configuration modelConfiguration = getModelConfiguration();
+ List children = modelConfiguration.getChildren();
+
+ String baseUri = NETTY + ":" + getProtocol() + "://" + getHost() + ":" + getPort();
+
+ QueryString queryStr = new QueryString();
+ traverseConfiguration(children, queryStr, HOST, PORT);
+
+ return URI.create(baseUri + queryStr.toString());
+ }
+
+}
diff --git a/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/v1/V1CamelNettyModelMarshaller.java b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/v1/V1CamelNettyModelMarshaller.java
new file mode 100644
index 000000000..706c65d8e
--- /dev/null
+++ b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/v1/V1CamelNettyModelMarshaller.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.netty.model.v1;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelMarshaller;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+import org.switchyard.config.model.composite.BindingModel;
+
+/**
+ * Netty tcp & udp model marshaller.
+ */
+public class V1CamelNettyModelMarshaller extends V1BaseCamelMarshaller {
+
+ private static final String BINDING_TCP = BindingModel.BINDING + '.' + V1CamelNettyTcpBindingModel.TCP;
+ private static final String BINDING_UDP = BindingModel.BINDING + '.' + V1CamelNettyUdpBindingModel.UDP;
+
+ /**
+ * Creates new marshaller.
+ *
+ * @param desc Descriptor
+ */
+ public V1CamelNettyModelMarshaller(Descriptor desc) {
+ super(desc);
+ }
+
+ /**
+ * Reads in the Configuration, looking for various knowledge models.
+ * If not found, it falls back to the super class (V1BaseCamelMarshaller).
+ *
+ * @param config the Configuration
+ * @return the Model
+ */
+ @Override
+ public Model read(Configuration config) {
+ String name = config.getName();
+ Descriptor desc = getDescriptor();
+ if (BINDING_TCP.equals(name)) {
+ return new V1CamelNettyTcpBindingModel(config, desc);
+ } else if (BINDING_UDP.equals(name)) {
+ return new V1CamelNettyUdpBindingModel(config, desc);
+ }
+ return super.read(config);
+ }
+
+}
diff --git a/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/v1/V1CamelNettyTcpBindingModel.java b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/v1/V1CamelNettyTcpBindingModel.java
new file mode 100644
index 000000000..4fb3fe123
--- /dev/null
+++ b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/v1/V1CamelNettyTcpBindingModel.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.netty.model.v1;
+
+import org.switchyard.component.camel.netty.model.CamelNettyTcpBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * Implementation of netty binding.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V1CamelNettyTcpBindingModel extends V1CamelNettyBindingModel
+ implements CamelNettyTcpBindingModel {
+
+ /**
+ * Protocol scheme.
+ */
+ public static final String TCP = "tcp";
+
+ private static final String TEXTLINE = "textline";
+ private static final String TCP_NO_DELAY = "tcpNoDelay";
+ private static final String KEEP_ALIVE = "keepAlive";
+
+
+ /**
+ * Create a new CamelNettyTcpBindingModel.
+ * @param namespace namespace
+ */
+ public V1CamelNettyTcpBindingModel(String namespace) {
+ super(TCP, namespace);
+ setModelChildrenOrder(TEXTLINE, TCP_NO_DELAY, KEEP_ALIVE);
+ }
+
+ /**
+ * Create a V1CamelNettyBindingModel from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V1CamelNettyTcpBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ @Override
+ public Boolean isTextline() {
+ return getBooleanConfig(TEXTLINE);
+ }
+
+ @Override
+ public V1CamelNettyTcpBindingModel setTextline(Boolean textline) {
+ return setConfig(TEXTLINE, textline);
+ }
+
+ @Override
+ public Boolean isTcpNoDelay() {
+ return getBooleanConfig(TCP_NO_DELAY);
+ }
+
+ @Override
+ public V1CamelNettyTcpBindingModel setTcpNoDelay(Boolean tcpNoDelay) {
+ return setConfig(TCP_NO_DELAY, tcpNoDelay);
+ }
+
+ @Override
+ public Boolean isKeepAlive() {
+ return getBooleanConfig(KEEP_ALIVE);
+ }
+
+ @Override
+ public V1CamelNettyTcpBindingModel setKeepAlive(Boolean keepAlive) {
+ return setConfig(KEEP_ALIVE, keepAlive);
+ }
+
+ @Override
+ protected String getProtocol() {
+ return TCP;
+ }
+
+}
diff --git a/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/v1/V1CamelNettyUdpBindingModel.java b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/v1/V1CamelNettyUdpBindingModel.java
new file mode 100644
index 000000000..102cb78f2
--- /dev/null
+++ b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/model/v1/V1CamelNettyUdpBindingModel.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.netty.model.v1;
+
+import org.switchyard.component.camel.netty.model.CamelNettyUdpBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * Implementation of netty udp binding.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V1CamelNettyUdpBindingModel extends V1CamelNettyBindingModel
+ implements CamelNettyUdpBindingModel {
+
+ /**
+ * Protocol scheme.
+ */
+ public static final String UDP = "udp";
+
+ private static final String BROADCAST = "broadcast";
+
+ /**
+ * Create a new CamelNettyUdpBindingModel.
+ * @param namespace namespace
+ */
+ public V1CamelNettyUdpBindingModel(String namespace) {
+ super(UDP, namespace);
+
+ setModelChildrenOrder(BROADCAST);
+ }
+
+ /**
+ * Create a V1CamelNettyBindingModel from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V1CamelNettyUdpBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ @Override
+ protected String getProtocol() {
+ return UDP;
+ }
+
+ @Override
+ public Boolean isBroadcast() {
+ return getBooleanConfig(BROADCAST);
+ }
+
+ @Override
+ public V1CamelNettyUdpBindingModel setBroadcast(Boolean broadcast) {
+ return setConfig(BROADCAST, broadcast);
+ }
+
+}
diff --git a/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/ssl/NettyBindingData.java b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/ssl/NettyBindingData.java
new file mode 100644
index 000000000..46f4c4175
--- /dev/null
+++ b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/ssl/NettyBindingData.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.netty.ssl;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.camel.Message;
+import org.apache.camel.component.netty.NettyConstants;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.handler.ssl.SslHandler;
+import org.switchyard.component.camel.common.composer.CamelBindingData;
+import org.switchyard.component.common.composer.SecurityBindingData;
+import org.switchyard.security.credential.Credential;
+import org.switchyard.security.credential.extractor.SSLSessionCredentialExtractor;
+
+/**
+ * Extension of {@link CamelBindingData} which provides {@link SecurityBindingData}
+ * extracted from SSLEngine used by netty.
+ */
+public class NettyBindingData extends CamelBindingData implements SecurityBindingData {
+
+ /**
+ * Creates netty binding data with given message.
+ *
+ * @param message Camel message.
+ */
+ public NettyBindingData(Message message) {
+ super(message);
+ }
+
+ @Override
+ public Set extractCredentials() {
+ HashSet credentials = new HashSet();
+ ChannelHandlerContext handlerContext = getMessage().getHeader(NettyConstants.NETTY_CHANNEL_HANDLER_CONTEXT, ChannelHandlerContext.class);
+ if (handlerContext != null) {
+ SslHandler sslHandler = handlerContext.getPipeline().get(SslHandler.class);
+ if (sslHandler != null) {
+ credentials.addAll(new SSLSessionCredentialExtractor().extract(sslHandler.getEngine().getSession()));
+ }
+ }
+ return credentials;
+ }
+
+}
diff --git a/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/ssl/NettyBindingDataCreator.java b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/ssl/NettyBindingDataCreator.java
new file mode 100644
index 000000000..9527bd601
--- /dev/null
+++ b/components/camel/camel-netty/src/main/java/org/switchyard/component/camel/netty/ssl/NettyBindingDataCreator.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.netty.ssl;
+
+import org.apache.camel.Message;
+import org.switchyard.component.camel.common.composer.BindingDataCreator;
+
+/**
+ * Netty-specific binding data creator.
+ */
+public class NettyBindingDataCreator implements BindingDataCreator {
+
+ @Override
+ public NettyBindingData createBindingData(Message message) {
+ return new NettyBindingData(message);
+ }
+
+}
diff --git a/components/camel/camel-netty/src/main/resources/META-INF/services/org.switchyard.deploy.Component b/components/camel/camel-netty/src/main/resources/META-INF/services/org.switchyard.deploy.Component
new file mode 100644
index 000000000..28c4833dd
--- /dev/null
+++ b/components/camel/camel-netty/src/main/resources/META-INF/services/org.switchyard.deploy.Component
@@ -0,0 +1 @@
+org.switchyard.component.camel.netty.deploy.CamelNettyComponent
diff --git a/components/camel/camel-netty/src/main/resources/META-INF/services/org/switchyard/component/camel/NettyEndpoint b/components/camel/camel-netty/src/main/resources/META-INF/services/org/switchyard/component/camel/NettyEndpoint
new file mode 100644
index 000000000..9ff84cc05
--- /dev/null
+++ b/components/camel/camel-netty/src/main/resources/META-INF/services/org/switchyard/component/camel/NettyEndpoint
@@ -0,0 +1 @@
+class=org.switchyard.component.camel.netty.ssl.NettyBindingDataCreator
\ No newline at end of file
diff --git a/components/camel/camel-netty/src/main/resources/org/switchyard/component/camel/netty/model/v1/camel-netty_1_0.xsd b/components/camel/camel-netty/src/main/resources/org/switchyard/component/camel/netty/model/v1/camel-netty_1_0.xsd
new file mode 100644
index 000000000..a51fa798b
--- /dev/null
+++ b/components/camel/camel-netty/src/main/resources/org/switchyard/component/camel/netty/model/v1/camel-netty_1_0.xsd
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-netty/src/main/resources/org/switchyard/component/camel/netty/model/v1/camel-netty_1_1.xsd b/components/camel/camel-netty/src/main/resources/org/switchyard/component/camel/netty/model/v1/camel-netty_1_1.xsd
new file mode 100644
index 000000000..bbfee56c9
--- /dev/null
+++ b/components/camel/camel-netty/src/main/resources/org/switchyard/component/camel/netty/model/v1/camel-netty_1_1.xsd
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-netty/src/main/resources/org/switchyard/component/camel/netty/model/v2/camel-netty_2_0.xsd b/components/camel/camel-netty/src/main/resources/org/switchyard/component/camel/netty/model/v2/camel-netty_2_0.xsd
new file mode 100644
index 000000000..97de37e08
--- /dev/null
+++ b/components/camel/camel-netty/src/main/resources/org/switchyard/component/camel/netty/model/v2/camel-netty_2_0.xsd
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-netty/src/main/resources/org/switchyard/config/model/descriptor.properties b/components/camel/camel-netty/src/main/resources/org/switchyard/config/model/descriptor.properties
new file mode 100644
index 000000000..9f9ee6c7f
--- /dev/null
+++ b/components/camel/camel-netty/src/main/resources/org/switchyard/config/model/descriptor.properties
@@ -0,0 +1,32 @@
+# Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+
+camel_netty_1_0.section=urn:switchyard-component-camel-netty:config
+camel_netty_1_0.version=1.0
+camel_netty_1_0.namespace=urn:switchyard-component-camel-netty:config:1.0
+camel_netty_1_0.schema=camel-netty_1_0.xsd
+camel_netty_1_0.location=/org/switchyard/component/camel/netty/model/v1
+camel_netty_1_0.marshaller=org.switchyard.component.camel.netty.model.v1.V1CamelNettyModelMarshaller
+
+camel_netty_1_1.section=urn:switchyard-component-camel-netty:config
+camel_netty_1_1.version=1.1
+camel_netty_1_1.namespace=urn:switchyard-component-camel-netty:config:1.1
+camel_netty_1_1.schema=camel-netty_1_1.xsd
+camel_netty_1_1.location=/org/switchyard/component/camel/netty/model/v1
+camel_netty_1_1.marshaller=org.switchyard.component.camel.netty.model.v1.V1CamelNettyModelMarshaller
+
+camel_netty_2_0.section=urn:switchyard-component-camel-netty:config
+camel_netty_2_0.version=2.0
+camel_netty_2_0.namespace=urn:switchyard-component-camel-netty:config:2.0
+camel_netty_2_0.schema=camel-netty_2_0.xsd
+camel_netty_2_0.location=/org/switchyard/component/camel/netty/model/v2
+camel_netty_2_0.marshaller=org.switchyard.component.camel.netty.model.v1.V1CamelNettyModelMarshaller
diff --git a/components/camel/camel-netty/src/test/java/org/switchyard/component/camel/netty/model/v1/CamelNettyTcpBindingSslContextParameterRefModelTest.java b/components/camel/camel-netty/src/test/java/org/switchyard/component/camel/netty/model/v1/CamelNettyTcpBindingSslContextParameterRefModelTest.java
new file mode 100644
index 000000000..2887d7c6e
--- /dev/null
+++ b/components/camel/camel-netty/src/test/java/org/switchyard/component/camel/netty/model/v1/CamelNettyTcpBindingSslContextParameterRefModelTest.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.netty.model.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.camel.component.netty.NettyEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.netty.model.CamelNettyNamespace;
+
+/**
+ * Test for {@link V1CamelNettyBindingModel} checking if it works with sslContextParametersRef.
+ *
+ * @author Lukasz Dywicki
+ */
+public class CamelNettyTcpBindingSslContextParameterRefModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-netty-tcp-binding-ssl-config-beans.xml";
+
+ private static final String HOST = "google.com";
+ private static final Integer PORT = 10230;
+ private static final Boolean SSL = true;
+ private static final String SSL_CONTEXT_PARAMETERS_REF = "#sslConfig";
+
+ private static final String CAMEL_URI = "netty:tcp://google.com:10230?" +
+ "ssl=true&sslContextParametersRef=#sslConfig";
+
+ public CamelNettyTcpBindingSslContextParameterRefModelTest() {
+ super(NettyEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V1CamelNettyTcpBindingModel createTestModel() {
+ return (V1CamelNettyTcpBindingModel) new V1CamelNettyTcpBindingModel(CamelNettyNamespace.V_1_0.uri())
+ .setHost(HOST)
+ .setPort(PORT)
+ .setSsl(SSL)
+ .setSslContextParametersRef(SSL_CONTEXT_PARAMETERS_REF);
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelNettyTcpBindingModel model) {
+ assertEquals(HOST, model.getHost());
+ assertEquals(PORT, model.getPort());
+ assertEquals(SSL, model.isSsl());
+ assertEquals(SSL_CONTEXT_PARAMETERS_REF, model.getSslContextParametersRef());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+}
\ No newline at end of file
diff --git a/components/camel/camel-netty/src/test/java/org/switchyard/component/camel/netty/model/v1/V1CamelNettyTcpBindingModelTest.java b/components/camel/camel-netty/src/test/java/org/switchyard/component/camel/netty/model/v1/V1CamelNettyTcpBindingModelTest.java
new file mode 100644
index 000000000..6d4316083
--- /dev/null
+++ b/components/camel/camel-netty/src/test/java/org/switchyard/component/camel/netty/model/v1/V1CamelNettyTcpBindingModelTest.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.netty.model.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.camel.component.netty.NettyEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.netty.model.CamelNettyNamespace;
+
+/**
+ * Test for {@link V1CamelNettyBindingModel}.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V1CamelNettyTcpBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-netty-tcp-binding-beans.xml";
+
+ private static final String HOST = "google.com";
+ private static final Integer PORT = 10230;
+ private static final Long RECEIVE_BUFFER_SIZE = 1024l;
+ private static final Long SEND_BUFFER_SIZE = 128l;
+ private static final Boolean SSL = true;
+ private static final String SSL_HANDLER = "#myCustomHandler";
+ private static final String PASSPHRASE = "camelRider";
+ private static final String SECURITY_PROVIDER = "BC";
+ private static final String KEY_STORE_FORMAT = "PCKS12";
+ private static final String KEY_STORE_FILE = "#ks";
+ private static final String TRUST_STORE_FILE = "#ts";
+ private static final Boolean REUSE_ADDRESS = true;
+ private static final Boolean ALLOW_DEFAULT_CODEC = false;
+ private static final Integer WORKER_COUNT = 10;
+ private static final Boolean SYNC = false;
+ private static final Boolean NEED_CLIENT_AUTH = true;
+ private static final Boolean DISCONNECT = true;
+ private static final Boolean TEXTLINE = false;
+ private static final Boolean TCP_NO_DELAY = true;
+ private static final Boolean KEEP_ALIVE = false;
+
+ private static final String CAMEL_URI = "netty:tcp://google.com:10230?" +
+ "receiveBufferSize=1024&sendBufferSize=128&reuseAddress=true&allowDefaultCodec=false&" +
+ "workerCount=10&sync=false&disconnect=true&textline=false&tcpNoDelay=true&" +
+ "keepAlive=false&keyStoreFormat=PCKS12&passphrase=camelRider&keyStoreFile=#ks&trustStoreFile=#ts&" +
+ "ssl=true&sslHandler=#myCustomHandler&needClientAuth=true&securityProvider=BC";
+
+ public V1CamelNettyTcpBindingModelTest() {
+ super(NettyEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V1CamelNettyTcpBindingModel createTestModel() {
+ return ((V1CamelNettyTcpBindingModel) new V1CamelNettyTcpBindingModel(CamelNettyNamespace.V_1_1.uri())
+ .setHost(HOST)
+ .setPort(PORT)
+ .setReceiveBufferSize(RECEIVE_BUFFER_SIZE)
+ .setSendBufferSize(SEND_BUFFER_SIZE)
+ .setSsl(SSL)
+ .setSslHandler(SSL_HANDLER)
+ .setNeedClientAuth(NEED_CLIENT_AUTH)
+ .setPassphrase(PASSPHRASE)
+ .setSecurityProvider(SECURITY_PROVIDER)
+ .setKeyStoreFormat(KEY_STORE_FORMAT)
+ .setKeyStoreFile(KEY_STORE_FILE)
+ .setTrustStoreFile(TRUST_STORE_FILE)
+ .setReuseAddress(REUSE_ADDRESS)
+ .setAllowDefaultCodec(ALLOW_DEFAULT_CODEC)
+ .setWorkerCount(WORKER_COUNT)
+ .setSync(SYNC)
+ .setDisconnect(DISCONNECT))
+ .setTextline(TEXTLINE)
+ .setTcpNoDelay(TCP_NO_DELAY)
+ .setKeepAlive(KEEP_ALIVE)
+ ;
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelNettyTcpBindingModel model) {
+ assertEquals(HOST, model.getHost());
+ assertEquals(PORT, model.getPort());
+ assertEquals(RECEIVE_BUFFER_SIZE, model.getReceiveBufferSize());
+ assertEquals(SEND_BUFFER_SIZE, model.getSendBufferSize());
+ assertEquals(SSL, model.isSsl());
+ assertEquals(SSL_HANDLER, model.getSslHandler());
+ assertEquals(NEED_CLIENT_AUTH, model.isNeedClientAuth());
+ assertEquals(SECURITY_PROVIDER, model.getSecurityProvider());
+ assertEquals(PASSPHRASE, model.getPassphrase());
+ assertEquals(KEY_STORE_FORMAT, model.getKeyStoreFormat());
+ assertEquals(KEY_STORE_FILE, model.getKeyStoreFile());
+ assertEquals(TRUST_STORE_FILE, model.getTrustStoreFile());
+ assertEquals(REUSE_ADDRESS, model.isReuseAddress());
+ assertEquals(ALLOW_DEFAULT_CODEC, model.isAllowDefaultCodec());
+ assertEquals(WORKER_COUNT, model.getWorkerCount());
+ assertEquals(SYNC, model.isSync());
+ assertEquals(DISCONNECT, model.isDisconnect());
+ assertEquals(TEXTLINE, model.isTextline());
+ assertEquals(TCP_NO_DELAY, model.isTcpNoDelay());
+ assertEquals(KEEP_ALIVE, model.isKeepAlive());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+}
\ No newline at end of file
diff --git a/components/camel/camel-netty/src/test/java/org/switchyard/component/camel/netty/model/v1/V1CamelNettyUdpBindingModelTest.java b/components/camel/camel-netty/src/test/java/org/switchyard/component/camel/netty/model/v1/V1CamelNettyUdpBindingModelTest.java
new file mode 100644
index 000000000..7ab9e06b5
--- /dev/null
+++ b/components/camel/camel-netty/src/test/java/org/switchyard/component/camel/netty/model/v1/V1CamelNettyUdpBindingModelTest.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.netty.model.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.camel.component.netty.NettyEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.netty.model.CamelNettyNamespace;
+
+/**
+ * Test for {@link V1CamelNettyBindingModel}.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V1CamelNettyUdpBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-netty-udp-binding-beans.xml";
+
+ private static final String HOST = "google.com";
+ private static final Integer PORT = 10231;
+ private static final Boolean BROADCAST = true;
+
+ private static final String CAMEL_URI = "netty:udp://google.com:10231?broadcast=true";
+
+ public V1CamelNettyUdpBindingModelTest() {
+ super(NettyEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V1CamelNettyUdpBindingModel createTestModel() {
+ return ((V1CamelNettyUdpBindingModel) new V1CamelNettyUdpBindingModel(CamelNettyNamespace.V_1_0.uri())
+ .setHost(HOST)
+ .setPort(PORT))
+ .setBroadcast(BROADCAST);
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelNettyUdpBindingModel model) {
+ assertEquals(HOST, model.getHost());
+ assertEquals(PORT, model.getPort());
+ assertEquals(BROADCAST, model.isBroadcast());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+}
\ No newline at end of file
diff --git a/components/camel/camel-netty/src/test/resources/v1/switchyard-netty-tcp-binding-beans.xml b/components/camel/camel-netty/src/test/resources/v1/switchyard-netty-tcp-binding-beans.xml
new file mode 100644
index 000000000..dba734c4a
--- /dev/null
+++ b/components/camel/camel-netty/src/test/resources/v1/switchyard-netty-tcp-binding-beans.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+ google.com
+ 10230
+ 1024
+ 128
+ true
+ #myCustomHandler
+ true
+ camelRider
+ BC
+ PCKS12
+ #ks
+ #ts
+ true
+ false
+ 10
+ false
+ true
+ false
+ true
+ false
+
+
+
+
+
diff --git a/components/camel/camel-netty/src/test/resources/v1/switchyard-netty-tcp-binding-ssl-config-beans.xml b/components/camel/camel-netty/src/test/resources/v1/switchyard-netty-tcp-binding-ssl-config-beans.xml
new file mode 100644
index 000000000..80ec80a7c
--- /dev/null
+++ b/components/camel/camel-netty/src/test/resources/v1/switchyard-netty-tcp-binding-ssl-config-beans.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+ google.com
+ 10230
+ true
+ #sslConfig
+
+
+
+
+
diff --git a/components/camel/camel-netty/src/test/resources/v1/switchyard-netty-udp-binding-beans.xml b/components/camel/camel-netty/src/test/resources/v1/switchyard-netty-udp-binding-beans.xml
new file mode 100644
index 000000000..23ac26518
--- /dev/null
+++ b/components/camel/camel-netty/src/test/resources/v1/switchyard-netty-udp-binding-beans.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+ google.com
+ 10231
+ true
+
+
+
+
+
diff --git a/components/camel/camel-quartz/pom.xml b/components/camel/camel-quartz/pom.xml
new file mode 100644
index 000000000..6af39f267
--- /dev/null
+++ b/components/camel/camel-quartz/pom.xml
@@ -0,0 +1,71 @@
+
+
+
+ 4.0.0
+
+ org.switchyard.components
+ switchyard-component-camel-parent
+ 2.1.0-SNAPSHOT
+
+ switchyard-component-camel-quartz
+ bundle
+ SwitchYard: Camel Component :: Quartz Binding
+ http://switchyard.org
+
+
+ org.switchyard.component.camel.quartz.*
+
+
+ org.apache.camel.component.quartz,
+ org.switchyard.config.model;org.switchyard.*;${switchyard.osgi.import.switchyard.version},
+ *
+
+
+
+
+ org.switchyard
+ switchyard-api
+
+
+ org.switchyard
+ switchyard-common
+
+
+ org.switchyard
+ switchyard-common-camel
+
+
+ org.switchyard.components
+ switchyard-component-common-camel
+
+
+ org.switchyard.components
+ switchyard-component-camel-switchyard
+
+
+ org.apache.camel
+ camel-core
+
+
+ org.apache.camel
+ camel-quartz
+
+
+ org.switchyard.components
+ switchyard-component-camel-test
+ test
+
+
+
diff --git a/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/deploy/CamelQuartzActivator.java b/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/deploy/CamelQuartzActivator.java
new file mode 100644
index 000000000..d4ba99c4a
--- /dev/null
+++ b/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/deploy/CamelQuartzActivator.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2014 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.quartz.deploy;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.camel.component.quartz.QuartzComponent;
+import org.switchyard.common.camel.SwitchYardCamelContext;
+import org.switchyard.common.type.Classes;
+import org.switchyard.component.camel.common.deploy.BaseBindingActivator;
+import org.switchyard.config.model.composite.BindingModel;
+import org.switchyard.deploy.ServiceHandler;
+
+/**
+ * Camel quartz activator.
+ */
+public class CamelQuartzActivator extends BaseBindingActivator {
+
+ /**
+ * Creates new activator instance.
+ *
+ * @param context Camel context.
+ * @param types Activation types.
+ */
+ public CamelQuartzActivator(SwitchYardCamelContext context, String[] types) {
+ super(context, types);
+ }
+
+ @Override
+ public ServiceHandler activateBinding(QName serviceName, BindingModel config) {
+ // SWITCHYARD-1970 - custom quartz.properties support
+ probeQuartzProperties();
+
+ return super.activateBinding(serviceName, config);
+ }
+
+ private void probeQuartzProperties() {
+ try {
+ URL props = Classes.getResource("org/quartz/quartz.properties");
+ if (props == null) {
+ return;
+ }
+ } catch (IOException e) {
+ return;
+ }
+
+ Set components = getCamelContext().getRegistry().findByType(QuartzComponent.class);
+ if (components.isEmpty()) {
+ QuartzComponent quartz = getCamelContext().getInjector().newInstance(QuartzComponent.class);
+ getCamelContext().getWritebleRegistry().put("quartz", quartz);
+ components.add(quartz);
+ }
+ for (QuartzComponent quartz : components) {
+ if (quartz.getPropertiesFile() == null) {
+ quartz.setPropertiesFile("org/quartz/quartz.properties");
+ }
+ }
+ }
+
+}
diff --git a/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/deploy/CamelQuartzComponent.java b/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/deploy/CamelQuartzComponent.java
new file mode 100644
index 000000000..51fc160a2
--- /dev/null
+++ b/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/deploy/CamelQuartzComponent.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.quartz.deploy;
+
+import org.switchyard.common.camel.SwitchYardCamelContext;
+import org.switchyard.component.camel.common.deploy.BaseBindingActivator;
+import org.switchyard.component.camel.common.deploy.BaseBindingComponent;
+import org.switchyard.component.camel.quartz.model.v2.V2CamelQuartzBindingModel;
+
+/**
+ * Quartz binding component.
+ */
+public class CamelQuartzComponent extends BaseBindingComponent {
+
+ /**
+ * Creates new component.
+ */
+ public CamelQuartzComponent() {
+ super("CamelQuartzComponent", V2CamelQuartzBindingModel.QUARTZ);
+ }
+
+ @Override
+ protected BaseBindingActivator createActivator(SwitchYardCamelContext context, String... types) {
+ return new CamelQuartzActivator(context, types);
+ }
+
+}
diff --git a/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/model/CamelQuartzBindingModel.java b/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/model/CamelQuartzBindingModel.java
new file mode 100644
index 000000000..f1c4a6912
--- /dev/null
+++ b/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/model/CamelQuartzBindingModel.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.quartz.model;
+
+import java.util.Date;
+
+import org.switchyard.component.camel.common.model.CamelBindingModel;
+
+/**
+ * Binding model for quartz endpoint.
+ *
+ * @author Lukasz Dywicki
+ */
+public interface CamelQuartzBindingModel extends CamelBindingModel {
+
+ /**
+ * Binding / camel endpoint prefix.
+ */
+ String QUARTZ = "quartz";
+
+ /**
+ * Returns the name of the timer.
+ * @return timer name
+ */
+ String getTimerName();
+
+ /**
+ * Sets the name of the timer.
+ * @param name timer name
+ * @return a reference to this config model
+ */
+ CamelQuartzBindingModel setTimerName(String name);
+
+ /**
+ * Returns the cron expression for this quartz endpoint.
+ * @return cron expression
+ */
+ String getCron();
+
+ /**
+ * Sets the cron expression for this quartz endpoint.
+ * @param cron expression
+ * @return a reference to this config model
+ */
+ CamelQuartzBindingModel setCron(String cron);
+
+ /**
+ * Whether the quartz schedule is stateful.
+ * @return true if the endpoint is stateful, false otherwise
+ */
+ Boolean isStateful();
+
+ /**
+ * Specifies whether the schedule should be stateful.
+ * @param stateful true for stateful, false for stateless
+ * @return a reference to this config model
+ */
+ CamelQuartzBindingModel setStateful(Boolean stateful);
+
+ /**
+ * Returns the schedule start time.
+ * @return Date corresponding to the schedule start time.
+ */
+ Date getStartTime();
+
+ /**
+ * Sets the schedule start time.
+ * @param startTime Date corresponding to the schedule start time.
+ * @return a reference to this config model
+ */
+ CamelQuartzBindingModel setStartTime(Date startTime);
+
+ /**
+ * Returns the schedule end time.
+ * @return Date corresponding to the schedule end time.
+ */
+ Date getEndTime();
+
+ /**
+ * Sets the schedule end time.
+ * @param endTime Date corresponding to the schedule end time.
+ * @return a reference to this config model
+ */
+ CamelQuartzBindingModel setEndTime(Date endTime);
+
+ /**
+ * Returns the schedule timezone.
+ * @return timeZone corresponding to the schedule timezone.
+ */
+ String getTimeZone();
+
+ /**
+ * Sets the schedule timezone.
+ * @param timeZone String corresponding to the schedule timezone.
+ * @return a reference to this config model
+ */
+ CamelQuartzBindingModel setTimeZone(String timeZone);
+
+ /**
+ * Returns the schedule repeat count.
+ * @return repeatCount Integer corresponding to the schedule repeat count.
+ */
+ Integer getRepeatCount();
+
+ /**
+ * Sets the schedule repeat interval.
+ * @param repeatCount Integer corresponding to the schedule repeat count.
+ * @return a reference to this config model
+ */
+ CamelQuartzBindingModel setRepeatCount(Integer repeatCount);
+
+ /**
+ * Returns the schedule repeat interval.
+ * @return repeatInterval Long corresponding to the schedule repeat interval.
+ */
+ Long getRepeatInterval();
+
+ /**
+ * Sets the repeat interval.
+ * @param repeatInterval Long corresponding to the schedule repeat interval.
+ * @return a reference to this config model
+ */
+ CamelQuartzBindingModel setRepeatInterval(Long repeatInterval);
+}
diff --git a/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/model/CamelQuartzNamespace.java b/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/model/CamelQuartzNamespace.java
new file mode 100644
index 000000000..d924879f1
--- /dev/null
+++ b/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/model/CamelQuartzNamespace.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.quartz.model;
+
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Namespace;
+
+/**
+ * A Camel Quartz config model namespace.
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+public enum CamelQuartzNamespace implements Namespace {
+
+ /** The 1.0 namespace. */
+ V_1_0("1.0"),
+ /** The 1.1 namespace. */
+ V_1_1("1.1"),
+ /** The 2.0 namespace. */
+ V_2_0("2.0"),
+ /** The default namespace. */
+ DEFAULT(null);
+
+ private final Util _util;
+
+ /**
+ * Constructs a new CamelQuartzNamespace with the specified version.
+ * @param version the specified version, or null to discover the default
+ */
+ CamelQuartzNamespace(String version) {
+ _util = new Util(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String section() {
+ return _util.section();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String version() {
+ return _util.version();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean versionMatches(Namespace namespace) {
+ return _util.versionMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String uri() {
+ return _util.uri();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean uriMatches(Namespace namespace) {
+ return _util.uriMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDefault() {
+ return this == DEFAULT || uriMatches(DEFAULT);
+ }
+
+ /**
+ * Gets the CamelQuartzNamespace for the specified uri, or null if no matching uris are found.
+ * @param uri the uri
+ * @return the CamelQuartzNamespace
+ */
+ public static CamelQuartzNamespace fromUri(String uri) {
+ return Util.fromUri(CamelQuartzNamespace.class, uri);
+ }
+
+ @SuppressWarnings("serial")
+ private static final class Util extends Namespace.Util {
+ // static final since we only want to do the somewhat expensive work of instantiating this once!
+ private static final Descriptor DESCRIPTOR = new Descriptor(CamelQuartzNamespace.class);
+ private Util(String version) {
+ super(DESCRIPTOR, "urn:switchyard-component-camel-quartz:config", version);
+ }
+ }
+
+}
diff --git a/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/model/v1/V1CamelQuartzBindingModel.java b/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/model/v1/V1CamelQuartzBindingModel.java
new file mode 100644
index 000000000..23f101ee5
--- /dev/null
+++ b/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/model/v1/V1CamelQuartzBindingModel.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.quartz.model.v1;
+
+import java.net.URI;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.camel.util.UnsafeUriCharactersEncoder;
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelBindingModel;
+import org.switchyard.component.camel.quartz.model.CamelQuartzBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * Configuration binding for quartz.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V1CamelQuartzBindingModel extends V1BaseCamelBindingModel
+ implements CamelQuartzBindingModel {
+
+ private static final String NAME = "name";
+ private static final String CRON = "cron";
+ private static final String STATEFUL = "stateful";
+ private static final String START_TIME = "trigger.startTime";
+ private static final String END_TIME = "trigger.endTime";
+ private static final String TIMEZONE = "trigger.timeZone";
+ private static final String REPEAT_COUNT = "trigger.repeatCount";
+ private static final String REPEAT_INTERVAL = "trigger.repeartInterval";
+
+ // Used for dateTime fields
+ private static final String DATE_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ss";
+
+ /**
+ * Create a new CamelQuartzBindingModel.
+ * @param namespace namespace
+ */
+ public V1CamelQuartzBindingModel(String namespace) {
+ super(QUARTZ, namespace);
+
+ setModelChildrenOrder(NAME, CRON, STATEFUL, START_TIME, END_TIME, TIMEZONE);
+ }
+
+ /**
+ * Create a V1CamelQuartzBindingModel from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V1CamelQuartzBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ @Override
+ public String getTimerName() {
+ return getConfig(NAME);
+ }
+
+ @Override
+ public V1CamelQuartzBindingModel setTimerName(String name) {
+ return setConfig(NAME, name);
+ }
+
+ @Override
+ public String getCron() {
+ return getConfig(CRON);
+ }
+
+ @Override
+ public V1CamelQuartzBindingModel setCron(String cron) {
+ return setConfig(CRON, cron);
+ }
+
+ @Override
+ public Boolean isStateful() {
+ return getBooleanConfig(STATEFUL);
+ }
+
+ @Override
+ public V1CamelQuartzBindingModel setStateful(Boolean stateful) {
+ return setConfig(STATEFUL, stateful);
+ }
+
+ @Override
+ public Date getStartTime() {
+ DateFormat startTimeFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return getDateConfig(START_TIME, startTimeFormat);
+ }
+
+ @Override
+ public V1CamelQuartzBindingModel setStartTime(Date startTime) {
+ DateFormat startTimeForamt = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return setConfig(START_TIME, startTimeForamt.format(startTime));
+ }
+
+ @Override
+ public Date getEndTime() {
+ DateFormat endTimeFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return getDateConfig(END_TIME, endTimeFormat);
+ }
+
+ @Override
+ public V1CamelQuartzBindingModel setEndTime(Date endTime) {
+ DateFormat endTimeFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return setConfig(END_TIME, endTimeFormat.format(endTime));
+ }
+
+ @Override
+ public String getTimeZone() {
+ return getConfig(TIMEZONE);
+ }
+
+ @Override
+ public V1CamelQuartzBindingModel setTimeZone(String timeZone) {
+ return setConfig(TIMEZONE, timeZone);
+ }
+
+ @Override
+ public Integer getRepeatCount() {
+ return getIntegerConfig(REPEAT_COUNT);
+ }
+
+ @Override
+ public V1CamelQuartzBindingModel setRepeatCount(Integer repeatCount) {
+ return setConfig(REPEAT_COUNT, repeatCount);
+ }
+
+ @Override
+ public Long getRepeatInterval() {
+ return getLongConfig(REPEAT_INTERVAL);
+ }
+
+ @Override
+ public V1CamelQuartzBindingModel setRepeatInterval(Long repeatInterval) {
+ return setConfig(REPEAT_INTERVAL, repeatInterval);
+ }
+
+ @Override
+ public URI getComponentURI() {
+ Configuration modelConfiguration = getModelConfiguration();
+ List children = modelConfiguration.getChildren();
+
+ String baseUri = QUARTZ + "://" + getTimerName();
+
+ QueryString queryStr = new QueryString();
+ traverseConfiguration(children, queryStr, NAME);
+
+ return URI.create(UnsafeUriCharactersEncoder.encode(baseUri + queryStr.toString()));
+ }
+
+}
diff --git a/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/model/v1/V1CamelQuartzModelMarshaller.java b/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/model/v1/V1CamelQuartzModelMarshaller.java
new file mode 100644
index 000000000..6f8f23ccc
--- /dev/null
+++ b/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/model/v1/V1CamelQuartzModelMarshaller.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.quartz.model.v1;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelMarshaller;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+import org.switchyard.config.model.composite.BindingModel;
+
+/**
+ * Camel quartz v1 model marshaler.
+ */
+public class V1CamelQuartzModelMarshaller extends V1BaseCamelMarshaller {
+
+ private static final String BINDING_QUARTZ = BindingModel.BINDING + '.' + V1CamelQuartzBindingModel.QUARTZ;
+
+ /**
+ * Creates new marshaller.
+ *
+ * @param desc Descriptor
+ */
+ public V1CamelQuartzModelMarshaller(Descriptor desc) {
+ super(desc);
+ }
+
+ /**
+ * Reads in the Configuration, looking for various knowledge models.
+ * If not found, it falls back to the super class (V1BaseCamelMarshaller).
+ *
+ * @param config the Configuration
+ * @return the Model
+ */
+ @Override
+ public Model read(Configuration config) {
+ String name = config.getName();
+ Descriptor desc = getDescriptor();
+ if (BINDING_QUARTZ.equals(name)) {
+ return new V1CamelQuartzBindingModel(config, desc);
+ }
+ return super.read(config);
+ }
+
+}
diff --git a/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/model/v2/V2CamelQuartzBindingModel.java b/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/model/v2/V2CamelQuartzBindingModel.java
new file mode 100644
index 000000000..5e7d54a22
--- /dev/null
+++ b/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/model/v2/V2CamelQuartzBindingModel.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.quartz.model.v2;
+
+import java.net.URI;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.camel.util.UnsafeUriCharactersEncoder;
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelBindingModel;
+import org.switchyard.component.camel.quartz.model.CamelQuartzBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * Configuration binding for quartz.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V2CamelQuartzBindingModel extends V1BaseCamelBindingModel
+ implements CamelQuartzBindingModel {
+
+ private static final String NAME = "name";
+ private static final String CRON = "cron";
+ private static final String STATEFUL = "stateful";
+ private static final String START_TIME = "trigger.startTime";
+ private static final String END_TIME = "trigger.endTime";
+ private static final String TIMEZONE = "trigger.timeZone";
+ private static final String REPEAT_COUNT = "trigger.repeatCount";
+ private static final String REPEAT_INTERVAL = "trigger.repeatInterval";
+
+ // Used for dateTime fields
+ private static final String DATE_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ss";
+
+ /**
+ * Create a new CamelQuartzBindingModel.
+ * @param namespace namespace
+ */
+ public V2CamelQuartzBindingModel(String namespace) {
+ super(QUARTZ, namespace);
+
+ setModelChildrenOrder(NAME, CRON, REPEAT_COUNT, REPEAT_INTERVAL, STATEFUL, START_TIME, END_TIME, TIMEZONE);
+ }
+
+ /**
+ * Create a V1CamelQuartzBindingModel from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V2CamelQuartzBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ @Override
+ public String getTimerName() {
+ return getConfig(NAME);
+ }
+
+ @Override
+ public V2CamelQuartzBindingModel setTimerName(String name) {
+ return setConfig(NAME, name);
+ }
+
+ @Override
+ public String getCron() {
+ return getConfig(CRON);
+ }
+
+ @Override
+ public V2CamelQuartzBindingModel setCron(String cron) {
+ return setConfig(CRON, cron);
+ }
+
+ @Override
+ public Boolean isStateful() {
+ return getBooleanConfig(STATEFUL);
+ }
+
+ @Override
+ public V2CamelQuartzBindingModel setStateful(Boolean stateful) {
+ return setConfig(STATEFUL, stateful);
+ }
+
+ @Override
+ public Date getStartTime() {
+ DateFormat startTimeFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return getDateConfig(START_TIME, startTimeFormat);
+ }
+
+ @Override
+ public V2CamelQuartzBindingModel setStartTime(Date startTime) {
+ DateFormat startTimeForamt = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return setConfig(START_TIME, startTimeForamt.format(startTime));
+ }
+
+ @Override
+ public Date getEndTime() {
+ DateFormat endTimeFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return getDateConfig(END_TIME, endTimeFormat);
+ }
+
+ @Override
+ public V2CamelQuartzBindingModel setEndTime(Date endTime) {
+ DateFormat endTimeFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return setConfig(END_TIME, endTimeFormat.format(endTime));
+ }
+
+ @Override
+ public String getTimeZone() {
+ return getConfig(TIMEZONE);
+ }
+
+ @Override
+ public V2CamelQuartzBindingModel setTimeZone(String timeZone) {
+ return setConfig(TIMEZONE, timeZone);
+ }
+
+ @Override
+ public Integer getRepeatCount() {
+ return getIntegerConfig(REPEAT_COUNT);
+ }
+
+ @Override
+ public V2CamelQuartzBindingModel setRepeatCount(Integer repeatCount) {
+ return setConfig(REPEAT_COUNT, repeatCount);
+ }
+
+ @Override
+ public Long getRepeatInterval() {
+ return getLongConfig(REPEAT_INTERVAL);
+ }
+
+ @Override
+ public V2CamelQuartzBindingModel setRepeatInterval(Long repeatInterval) {
+ return setConfig(REPEAT_INTERVAL, repeatInterval);
+ }
+
+ @Override
+ public URI getComponentURI() {
+ Configuration modelConfiguration = getModelConfiguration();
+ List children = modelConfiguration.getChildren();
+
+ String baseUri = QUARTZ + "://" + getTimerName();
+
+ QueryString queryStr = new QueryString();
+ traverseConfiguration(children, queryStr, NAME);
+
+ return URI.create(UnsafeUriCharactersEncoder.encode(baseUri + queryStr.toString()));
+ }
+
+}
diff --git a/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/model/v2/V2CamelQuartzModelMarshaller.java b/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/model/v2/V2CamelQuartzModelMarshaller.java
new file mode 100644
index 000000000..dc9a6520d
--- /dev/null
+++ b/components/camel/camel-quartz/src/main/java/org/switchyard/component/camel/quartz/model/v2/V2CamelQuartzModelMarshaller.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.quartz.model.v2;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelMarshaller;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+import org.switchyard.config.model.composite.BindingModel;
+
+/**
+ * Camel quartz v2 model marshaler.
+ */
+public class V2CamelQuartzModelMarshaller extends V1BaseCamelMarshaller {
+
+ private static final String BINDING_QUARTZ = BindingModel.BINDING + '.' + V2CamelQuartzBindingModel.QUARTZ;
+
+ /**
+ * Creates new marshaller.
+ *
+ * @param desc Descriptor
+ */
+ public V2CamelQuartzModelMarshaller(Descriptor desc) {
+ super(desc);
+ }
+
+ /**
+ * Reads in the Configuration, looking for various knowledge models.
+ * If not found, it falls back to the super class (V1BaseCamelMarshaller).
+ *
+ * @param config the Configuration
+ * @return the Model
+ */
+ @Override
+ public Model read(Configuration config) {
+ String name = config.getName();
+ Descriptor desc = getDescriptor();
+ if (BINDING_QUARTZ.equals(name)) {
+ return new V2CamelQuartzBindingModel(config, desc);
+ }
+ return super.read(config);
+ }
+
+}
diff --git a/components/camel/camel-quartz/src/main/resources/META-INF/services/org.switchyard.deploy.Component b/components/camel/camel-quartz/src/main/resources/META-INF/services/org.switchyard.deploy.Component
new file mode 100644
index 000000000..4f97b37f3
--- /dev/null
+++ b/components/camel/camel-quartz/src/main/resources/META-INF/services/org.switchyard.deploy.Component
@@ -0,0 +1 @@
+org.switchyard.component.camel.quartz.deploy.CamelQuartzComponent
diff --git a/components/camel/camel-quartz/src/main/resources/org/switchyard/component/camel/quartz/model/v1/camel-quartz_1_0.xsd b/components/camel/camel-quartz/src/main/resources/org/switchyard/component/camel/quartz/model/v1/camel-quartz_1_0.xsd
new file mode 100644
index 000000000..cc4fc81f3
--- /dev/null
+++ b/components/camel/camel-quartz/src/main/resources/org/switchyard/component/camel/quartz/model/v1/camel-quartz_1_0.xsd
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-quartz/src/main/resources/org/switchyard/component/camel/quartz/model/v1/camel-quartz_1_1.xsd b/components/camel/camel-quartz/src/main/resources/org/switchyard/component/camel/quartz/model/v1/camel-quartz_1_1.xsd
new file mode 100644
index 000000000..1e32b43ec
--- /dev/null
+++ b/components/camel/camel-quartz/src/main/resources/org/switchyard/component/camel/quartz/model/v1/camel-quartz_1_1.xsd
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-quartz/src/main/resources/org/switchyard/component/camel/quartz/model/v2/camel-quartz_2_0.xml b/components/camel/camel-quartz/src/main/resources/org/switchyard/component/camel/quartz/model/v2/camel-quartz_2_0.xml
new file mode 100644
index 000000000..c2fa0b04f
--- /dev/null
+++ b/components/camel/camel-quartz/src/main/resources/org/switchyard/component/camel/quartz/model/v2/camel-quartz_2_0.xml
@@ -0,0 +1,4 @@
+
+
+ tns:name
+
diff --git a/components/camel/camel-quartz/src/main/resources/org/switchyard/component/camel/quartz/model/v2/camel-quartz_2_0.xsd b/components/camel/camel-quartz/src/main/resources/org/switchyard/component/camel/quartz/model/v2/camel-quartz_2_0.xsd
new file mode 100644
index 000000000..87e648a56
--- /dev/null
+++ b/components/camel/camel-quartz/src/main/resources/org/switchyard/component/camel/quartz/model/v2/camel-quartz_2_0.xsd
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-quartz/src/main/resources/org/switchyard/config/model/descriptor.properties b/components/camel/camel-quartz/src/main/resources/org/switchyard/config/model/descriptor.properties
new file mode 100644
index 000000000..b63b44808
--- /dev/null
+++ b/components/camel/camel-quartz/src/main/resources/org/switchyard/config/model/descriptor.properties
@@ -0,0 +1,32 @@
+# Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+
+camel_quartz_1_0.section=urn:switchyard-component-camel-quartz:config
+camel_quartz_1_0.version=1.0
+camel_quartz_1_0.namespace=urn:switchyard-component-camel-quartz:config:1.0
+camel_quartz_1_0.schema=camel-quartz_1_0.xsd
+camel_quartz_1_0.location=/org/switchyard/component/camel/quartz/model/v1/
+camel_quartz_1_0.marshaller=org.switchyard.component.camel.quartz.model.v1.V1CamelQuartzModelMarshaller
+
+camel_quartz_1_1.section=urn:switchyard-component-camel-quartz:config
+camel_quartz_1_1.version=1.1
+camel_quartz_1_1.namespace=urn:switchyard-component-camel-quartz:config:1.1
+camel_quartz_1_1.schema=camel-quartz_1_1.xsd
+camel_quartz_1_1.location=/org/switchyard/component/camel/quartz/model/v1/
+camel_quartz_1_1.marshaller=org.switchyard.component.camel.quartz.model.v1.V1CamelQuartzModelMarshaller
+
+camel_quartz_2_0.section=urn:switchyard-component-camel-quartz:config
+camel_quartz_2_0.version=2.0
+camel_quartz_2_0.namespace=urn:switchyard-component-camel-quartz:config:2.0
+camel_quartz_2_0.schema=camel-quartz_2_0.xsd
+camel_quartz_2_0.location=/org/switchyard/component/camel/quartz/model/v2/
+camel_quartz_2_0.marshaller=org.switchyard.component.camel.quartz.model.v2.V2CamelQuartzModelMarshaller
diff --git a/components/camel/camel-quartz/src/test/java/org/switchyard/component/camel/quartz/model/v1/V1CamelQuartzBindingModelTest.java b/components/camel/camel-quartz/src/test/java/org/switchyard/component/camel/quartz/model/v1/V1CamelQuartzBindingModelTest.java
new file mode 100644
index 000000000..dedc197dd
--- /dev/null
+++ b/components/camel/camel-quartz/src/test/java/org/switchyard/component/camel/quartz/model/v1/V1CamelQuartzBindingModelTest.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.quartz.model.v1;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Collections;
+import java.util.Date;
+
+import org.apache.camel.component.quartz.QuartzEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.quartz.model.CamelQuartzNamespace;
+
+/**
+ * Test for {@link V1CamelQuartzBindingModel}.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V1CamelQuartzBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v1/switchyard-quartz-binding-beans.xml";
+
+ // Used for dateTime fields
+ private static DateFormat _dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+
+ private static final String NAME = "MyJob";
+ private static final String CRON = "0 0 12 * * ?";
+ private static final Boolean STATEFUL = true;
+ private static Date START_TIME;
+ private static Date END_TIME;
+ private static String TIMEZONE;
+
+ private static final String CAMEL_URI = "quartz://MyJob?cron=0 0 12 * * ?&stateful=true" +
+ "&trigger.startTime=2011-01-01T12:00:00&trigger.endTime=2011-01-01T12:00:00&trigger.timeZone=America/New_York";
+
+ static {
+ try {
+ START_TIME = _dateFormat.parse("2011-01-01T12:00:00");
+ END_TIME = _dateFormat.parse("2011-01-01T12:00:00");
+ TIMEZONE = "America/New_York";
+ } catch (Exception e) { /* ignore */ }
+ }
+
+ public V1CamelQuartzBindingModelTest() {
+ super(QuartzEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V1CamelQuartzBindingModel createTestModel() {
+ final V1CamelQuartzBindingModel model = new V1CamelQuartzBindingModel(CamelQuartzNamespace.V_1_1.uri());
+ model.setAdditionalUriParameters(createAdditionalUriParametersModel(CamelQuartzNamespace.V_1_1.uri(), Collections.singletonMap("trigger.timeZone", "GMT")));
+ return (V1CamelQuartzBindingModel) model
+ .setTimerName(NAME)
+ .setCron(CRON)
+ .setStateful(STATEFUL)
+ .setStartTime(START_TIME)
+ .setEndTime(END_TIME)
+ .setTimeZone(TIMEZONE);
+ }
+
+ @Override
+ protected void createModelAssertions(V1CamelQuartzBindingModel model) {
+ assertEquals(NAME, model.getTimerName());
+ assertEquals(CRON, model.getCron());
+ assertEquals(STATEFUL, model.isStateful());
+ assertEquals(START_TIME, model.getStartTime());
+ assertEquals(END_TIME, model.getEndTime());
+ assertEquals(TIMEZONE, model.getTimeZone());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-quartz/src/test/java/org/switchyard/component/camel/quartz/model/v2/V2CamelQuartzBindingModelTest.java b/components/camel/camel-quartz/src/test/java/org/switchyard/component/camel/quartz/model/v2/V2CamelQuartzBindingModelTest.java
new file mode 100644
index 000000000..e55704af3
--- /dev/null
+++ b/components/camel/camel-quartz/src/test/java/org/switchyard/component/camel/quartz/model/v2/V2CamelQuartzBindingModelTest.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.quartz.model.v2;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Collections;
+import java.util.Date;
+
+import org.apache.camel.component.quartz.QuartzEndpoint;
+import org.junit.Test;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.quartz.model.CamelQuartzNamespace;
+
+/**
+ * Test for {@link V2CamelQuartzBindingModel}.
+ *
+ * @author Lukasz Dywicki
+ */
+public class V2CamelQuartzBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v2/switchyard-quartz-binding-beans.xml";
+
+ // Used for dateTime fields
+ private static DateFormat _dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+
+ private static final String NAME = "MyJob";
+ private static final String CRON = "0 0 12 * * ?";
+ private static final Integer REPEAT_COUNT = new Integer(3);
+ private static final Long REPEAT_INTERVAL = new Long(100000);
+ private static final Boolean STATEFUL = true;
+ private static Date START_TIME;
+ private static Date END_TIME;
+ private static String TIMEZONE;
+
+ private static final String CAMEL_URI = "quartz://MyJob?cron=0 0 12 * * ?&stateful=true" +
+ "&trigger.startTime=2011-01-01T12:00:00&trigger.endTime=2011-01-01T12:00:00&trigger.timeZone=America/New_York";
+
+ static {
+ try {
+ START_TIME = _dateFormat.parse("2011-01-01T12:00:00");
+ END_TIME = _dateFormat.parse("2011-01-01T12:00:00");
+ TIMEZONE = "America/New_York";
+ } catch (Exception e) { /* ignore */ }
+ }
+
+ public V2CamelQuartzBindingModelTest() {
+ super(QuartzEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V2CamelQuartzBindingModel createTestModel() {
+ final V2CamelQuartzBindingModel model = new V2CamelQuartzBindingModel(CamelQuartzNamespace.V_2_0.uri());
+ model.setAdditionalUriParameters(createAdditionalUriParametersModel(CamelQuartzNamespace.V_2_0.uri(), Collections.singletonMap("trigger.timeZone", "GMT")));
+ return (V2CamelQuartzBindingModel) model
+ .setTimerName(NAME)
+ .setCron(CRON)
+ .setStateful(STATEFUL)
+ .setStartTime(START_TIME)
+ .setEndTime(END_TIME)
+ .setTimeZone(TIMEZONE);
+ }
+
+ protected V2CamelQuartzBindingModel createAlternateTestModel() {
+ final V2CamelQuartzBindingModel model = new V2CamelQuartzBindingModel(CamelQuartzNamespace.V_2_0.uri());
+ model.setAdditionalUriParameters(createAdditionalUriParametersModel(CamelQuartzNamespace.V_2_0.uri(), Collections.singletonMap("trigger.timeZone", "GMT")));
+ return (V2CamelQuartzBindingModel) model
+ .setTimerName(NAME)
+ .setRepeatCount(REPEAT_COUNT)
+ .setRepeatInterval(REPEAT_INTERVAL)
+ .setStateful(STATEFUL)
+ .setStartTime(START_TIME)
+ .setEndTime(END_TIME)
+ .setTimeZone(TIMEZONE);
+ }
+
+ /**
+ * Verify correctness of model created by test.
+ *
+ * @throws Exception If model can not be read
+ */
+ @Test
+ public void testAlternateModelIsValid() throws Exception {
+ validModel(createAlternateTestModel());
+ }
+
+ /**
+ * Verify assertions with model binding.
+ */
+ @Test
+ public void testModelAssertionsFromAlternateModel() {
+ createAlternateModelAssertions(createAlternateTestModel());
+ }
+
+ @Override
+ protected void createModelAssertions(V2CamelQuartzBindingModel model) {
+ assertEquals(NAME, model.getTimerName());
+ assertEquals(CRON, model.getCron());
+ assertEquals(STATEFUL, model.isStateful());
+ assertEquals(START_TIME, model.getStartTime());
+ assertEquals(END_TIME, model.getEndTime());
+ assertEquals(TIMEZONE, model.getTimeZone());
+ }
+
+ protected void createAlternateModelAssertions(V2CamelQuartzBindingModel model) {
+ assertEquals(NAME, model.getTimerName());
+ assertEquals(REPEAT_INTERVAL, model.getRepeatInterval());
+ assertEquals(REPEAT_COUNT, model.getRepeatCount());
+ assertEquals(STATEFUL, model.isStateful());
+ assertEquals(START_TIME, model.getStartTime());
+ assertEquals(END_TIME, model.getEndTime());
+ assertEquals(TIMEZONE, model.getTimeZone());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-quartz/src/test/resources/v1/switchyard-quartz-binding-beans.xml b/components/camel/camel-quartz/src/test/resources/v1/switchyard-quartz-binding-beans.xml
new file mode 100644
index 000000000..d01ea54ab
--- /dev/null
+++ b/components/camel/camel-quartz/src/test/resources/v1/switchyard-quartz-binding-beans.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+ MyJob
+ 0 0 12 * * ?
+ true
+ 2011-01-01T12:00:00
+ 2011-01-01T12:00:00
+ America/New_York
+
+
+
+
+
diff --git a/components/camel/camel-quartz/src/test/resources/v2/switchyard-quartz-binding-beans.xml b/components/camel/camel-quartz/src/test/resources/v2/switchyard-quartz-binding-beans.xml
new file mode 100644
index 000000000..dbbb1f1ff
--- /dev/null
+++ b/components/camel/camel-quartz/src/test/resources/v2/switchyard-quartz-binding-beans.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+ MyJob
+ 0 0 12 * * ?
+ true
+ 2011-01-01T12:00:00
+ 2011-01-01T12:00:00
+ America/New_York
+
+
+
+
+
diff --git a/components/camel/camel-rss/pom.xml b/components/camel/camel-rss/pom.xml
new file mode 100644
index 000000000..84684300d
--- /dev/null
+++ b/components/camel/camel-rss/pom.xml
@@ -0,0 +1,55 @@
+
+
+
+ 4.0.0
+
+ org.switchyard.components
+ switchyard-component-camel-parent
+ 2.1.0-SNAPSHOT
+
+ switchyard-component-camel-rss
+ bundle
+ SwitchYard: Camel Component :: RSS Binding
+ http://switchyard.org
+
+
+ org.switchyard.component.camel.rss.*
+
+
+ org.apache.camel.component.rss,
+ org.switchyard.config.model;org.switchyard.*;${switchyard.osgi.import.switchyard.version},
+ *
+
+
+
+
+ org.switchyard.components
+ switchyard-component-common-camel
+
+
+ org.switchyard.components
+ switchyard-component-camel-switchyard
+
+
+ org.apache.camel
+ camel-rss
+
+
+ org.switchyard.components
+ switchyard-component-camel-test
+ test
+
+
+
diff --git a/components/camel/camel-rss/src/main/java/org/switchyard/component/camel/rss/deploy/CamelRSSComponent.java b/components/camel/camel-rss/src/main/java/org/switchyard/component/camel/rss/deploy/CamelRSSComponent.java
new file mode 100644
index 000000000..b210f25dc
--- /dev/null
+++ b/components/camel/camel-rss/src/main/java/org/switchyard/component/camel/rss/deploy/CamelRSSComponent.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.rss.deploy;
+
+import org.switchyard.component.camel.common.deploy.BaseBindingComponent;
+import org.switchyard.component.camel.rss.model.v2.V2CamelRSSBindingModel;
+
+/**
+ * RSS binding component.
+ */
+public class CamelRSSComponent extends BaseBindingComponent {
+
+ /**
+ * Creates new component.
+ */
+ public CamelRSSComponent() {
+ super("CamelRSSComponent", V2CamelRSSBindingModel.RSS);
+ }
+
+}
diff --git a/components/camel/camel-rss/src/main/java/org/switchyard/component/camel/rss/model/CamelRSSBindingModel.java b/components/camel/camel-rss/src/main/java/org/switchyard/component/camel/rss/model/CamelRSSBindingModel.java
new file mode 100644
index 000000000..e46908e48
--- /dev/null
+++ b/components/camel/camel-rss/src/main/java/org/switchyard/component/camel/rss/model/CamelRSSBindingModel.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.rss.model;
+
+import java.net.URI;
+import java.util.Date;
+
+import org.switchyard.component.camel.common.model.CamelBindingModel;
+import org.switchyard.component.camel.common.model.consumer.CamelScheduledPollConsumer;
+
+/**
+ * Represents the configuration settings for an RSS endpoint in Camel. The
+ * RSS component only supports consumer processing, so this binding can only
+ * be used on a service (not a reference).
+ */
+public interface CamelRSSBindingModel extends CamelBindingModel {
+
+ /**
+ * The RSS feed URI which will be polled.
+ * @return the feed URI or null if it has not been specified
+ */
+ URI getFeedURI();
+
+ /**
+ * Set the RSS feed URI.
+ * @param uri feed URI
+ * @return a reference to this RSS binding model
+ */
+ CamelRSSBindingModel setFeedURI(URI uri);
+
+ /**
+ * Whether feed entries will be split on each poll.
+ * @return split setting or null if no configuration has been specified
+ */
+ Boolean isSplitEntries();
+
+ /**
+ * Specify that feed entries will be split on each poll.
+ * @param split true if entries should be split, false otherwise
+ * @return a reference to this RSS binding model
+ */
+ CamelRSSBindingModel setSplitEntries(Boolean split);
+
+ /**
+ * Whether the component should only return new RSS entries.
+ * @return filter setting or null if no configuration has been specified
+ */
+ Boolean isFilter();
+
+ /**
+ * Specify that the source feed should be filtered.
+ * @param filter true to filter the feed
+ * @return a reference to this RSS binding model
+ */
+ CamelRSSBindingModel setFilter(Boolean filter);
+
+ /**
+ * Set the start date used by the filter for pulling new feeds.
+ * @param lastUpdate date after which entries should be pulled
+ * @return a reference to this RSS binding model
+ */
+ CamelRSSBindingModel setLastUpdate(Date lastUpdate);
+
+ /**
+ * The start date used by the filter for pulling new feeds.
+ * @return date after which entries should be pulled or null if no
+ * configuration has been specified
+ */
+ Date getLastUpdate();
+
+ /**
+ * Enables throttled delivery of feeds.
+ * @param throttled specify true to enable throttling
+ * @return a reference to this RSS binding model
+ */
+ CamelRSSBindingModel setThrottleEntries(Boolean throttled);
+
+ /**
+ * Whether throttling is enabled for this endpoint.
+ * @return throttle setting or null if no configuration has been specified
+ */
+ Boolean isThrottleEntries();
+
+ /**
+ * Specify whether the underlying Abdera feed object is included as a header.
+ * @param header true to include the header, false to not include
+ * @return a reference to this RSS binding model
+ */
+ CamelRSSBindingModel setFeedHeader(Boolean header);
+
+ /**
+ * Whether the Abdera feed object is included as a header.
+ * @return feed header setting or null if no configuration has been specified
+ */
+ Boolean isFeedHeader();
+
+ /**
+ * Specifies whether split entries are sorted by date.
+ * @param sorted set to true for split entries to be sorted
+ * @return a reference to this RSS binding model
+ */
+ CamelRSSBindingModel setSortEntries(Boolean sorted);
+
+ /**
+ * Whether split entries are sorted by date.
+ * @return sort setting or null if no configuration has been specified
+ */
+ Boolean isSortEntries();
+
+ /**
+ * Sets consumer properties for RSS.
+ *
+ * @param consumer Configuration of consumer.
+ * @return a reference to this RSS binding model
+ */
+ CamelRSSBindingModel setConsumer(CamelScheduledPollConsumer consumer);
+
+ /**
+ * @return RSS consumer configuration.
+ */
+ CamelScheduledPollConsumer getConsumer();
+
+}
diff --git a/components/camel/camel-rss/src/main/java/org/switchyard/component/camel/rss/model/CamelRSSNamespace.java b/components/camel/camel-rss/src/main/java/org/switchyard/component/camel/rss/model/CamelRSSNamespace.java
new file mode 100644
index 000000000..584b81f48
--- /dev/null
+++ b/components/camel/camel-rss/src/main/java/org/switchyard/component/camel/rss/model/CamelRSSNamespace.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.rss.model;
+
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Namespace;
+
+/**
+ * A Camel RSS config model namespace.
+ *
+ * @author David Ward <dward@jboss.org > © 2013 Red Hat Inc.
+ */
+public enum CamelRSSNamespace implements Namespace {
+
+ /** The 2.0 namespace. */
+ V_2_0("2.0"),
+ /** The default namespace. */
+ DEFAULT(null);
+
+ private final Util _util;
+
+ /**
+ * Constructs a new CamelRSSNamespace with the specified version.
+ * @param version the specified version, or null to discover the default
+ */
+ CamelRSSNamespace(String version) {
+ _util = new Util(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String section() {
+ return _util.section();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String version() {
+ return _util.version();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean versionMatches(Namespace namespace) {
+ return _util.versionMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String uri() {
+ return _util.uri();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean uriMatches(Namespace namespace) {
+ return _util.uriMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDefault() {
+ return this == DEFAULT || uriMatches(DEFAULT);
+ }
+
+ /**
+ * Gets the CamelRSSNamespace for the specified uri, or null if no matching uris are found.
+ * @param uri the uri
+ * @return the CamelRSSNamespace
+ */
+ public static CamelRSSNamespace fromUri(String uri) {
+ return Util.fromUri(CamelRSSNamespace.class, uri);
+ }
+
+ @SuppressWarnings("serial")
+ private static final class Util extends Namespace.Util {
+ // static final since we only want to do the somewhat expensive work of instantiating this once!
+ private static final Descriptor DESCRIPTOR = new Descriptor(CamelRSSNamespace.class);
+ private Util(String version) {
+ super(DESCRIPTOR, "urn:switchyard-component-camel-rss:config", version);
+ }
+ }
+
+}
diff --git a/components/camel/camel-rss/src/main/java/org/switchyard/component/camel/rss/model/v2/V2CamelRSSBindingModel.java b/components/camel/camel-rss/src/main/java/org/switchyard/component/camel/rss/model/v2/V2CamelRSSBindingModel.java
new file mode 100644
index 000000000..ef309a8b4
--- /dev/null
+++ b/components/camel/camel-rss/src/main/java/org/switchyard/component/camel/rss/model/v2/V2CamelRSSBindingModel.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.rss.model.v2;
+
+import java.net.URI;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.common.model.consumer.CamelScheduledPollConsumer;
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelBindingModel;
+import org.switchyard.component.camel.common.model.v1.V1CamelScheduledPollConsumer;
+import org.switchyard.component.camel.rss.model.CamelRSSBindingModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * Implementation of RSSBindingModel.
+ */
+public class V2CamelRSSBindingModel extends V1BaseCamelBindingModel
+ implements CamelRSSBindingModel {
+
+ /**
+ * Camel endpoint type.
+ */
+ public static final String RSS = "rss";
+
+ /**
+ * Camel endpoint configuration values.
+ */
+ private static final String FEED_URI = "feedURI";
+ private static final String SPLIT_ENTRIES = "splitEntries";
+ private static final String FILTER = "filter";
+ private static final String LAST_UPDATE = "lastUpdate";
+ private static final String THROTTLE_ENTRIES = "throttleEntries";
+ private static final String FEED_HEADER = "feedHeader";
+ private static final String SORT_ENTRIES = "sortEntries";
+
+ private CamelScheduledPollConsumer _consume;
+
+ // Used for dateTime fields
+ private static final String DATE_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ss";
+
+ /**
+ * Create a new RSSBindingModel.
+ * @param namespace namespace
+ */
+ public V2CamelRSSBindingModel(String namespace) {
+ super(RSS, namespace);
+
+ setModelChildrenOrder(FEED_URI, SPLIT_ENTRIES, FILTER, LAST_UPDATE,
+ THROTTLE_ENTRIES, FEED_HEADER, SORT_ENTRIES, CONSUME);
+ }
+
+ /**
+ * Create a RSSBindingModel from the specified configuration and descriptor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V2CamelRSSBindingModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ @Override
+ public URI getFeedURI() {
+ String uriStr = getConfig(FEED_URI);
+ if (uriStr != null) {
+ return URI.create(uriStr);
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public V2CamelRSSBindingModel setFeedURI(URI uri) {
+ return setConfig(FEED_URI, uri.toString());
+ }
+
+ @Override
+ public Date getLastUpdate() {
+ final DateFormat lastUpdateDateFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return getDateConfig(LAST_UPDATE, lastUpdateDateFormat);
+ }
+
+ @Override
+ public V2CamelRSSBindingModel setLastUpdate(Date date) {
+ final DateFormat lastUpdateDateFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ setConfig(LAST_UPDATE, lastUpdateDateFormat.format(date));
+ return this;
+ }
+
+ @Override
+ public Boolean isFeedHeader() {
+ return getBooleanConfig(FEED_HEADER);
+ }
+
+ @Override
+ public V2CamelRSSBindingModel setFeedHeader(Boolean feedHeader) {
+ return setConfig(FEED_HEADER, feedHeader);
+ }
+
+ @Override
+ public Boolean isFilter() {
+ return getBooleanConfig(FILTER);
+ }
+
+ @Override
+ public V2CamelRSSBindingModel setFilter(Boolean filtered) {
+ return setConfig(FILTER, filtered);
+ }
+
+ @Override
+ public Boolean isSortEntries() {
+ return getBooleanConfig(SORT_ENTRIES);
+ }
+
+ @Override
+ public V2CamelRSSBindingModel setSortEntries(Boolean sorted) {
+ return setConfig(SORT_ENTRIES, sorted);
+ }
+
+ @Override
+ public Boolean isSplitEntries() {
+ return getBooleanConfig(SPLIT_ENTRIES);
+ }
+
+ @Override
+ public V2CamelRSSBindingModel setSplitEntries(Boolean split) {
+ return setConfig(SPLIT_ENTRIES, String.valueOf(split));
+ }
+
+ @Override
+ public Boolean isThrottleEntries() {
+ return getBooleanConfig(THROTTLE_ENTRIES);
+ }
+
+ @Override
+ public V2CamelRSSBindingModel setThrottleEntries(Boolean throttled) {
+ return setConfig(THROTTLE_ENTRIES, String.valueOf(throttled));
+ }
+
+
+ @Override
+ public CamelScheduledPollConsumer getConsumer() {
+ if (_consume == null) {
+ Configuration config = getModelConfiguration().getFirstChild(CONSUME);
+ _consume = new V1CamelScheduledPollConsumer(config,
+ getModelDescriptor());
+ }
+ return _consume;
+ }
+
+ @Override
+ public V2CamelRSSBindingModel setConsumer(CamelScheduledPollConsumer consumer) {
+ Configuration config = getModelConfiguration().getFirstChild(CONSUME);
+ if (config != null) {
+ // set an existing config value
+ getModelConfiguration().removeChildren(CONSUME);
+ getModelConfiguration().addChild(((V1CamelScheduledPollConsumer) consumer)
+ .getModelConfiguration());
+ } else {
+ setChildModel((V1CamelScheduledPollConsumer) consumer);
+ }
+ _consume = consumer;
+ return this;
+ }
+
+ @Override
+ public URI getComponentURI() {
+ Configuration modelConfiguration = getModelConfiguration();
+ List children = modelConfiguration.getChildren();
+
+ String baseUri = RSS + "://" + getFeedURI();
+
+ QueryString queryStr = new QueryString();
+ traverseConfiguration(children, queryStr, FEED_URI);
+
+ return URI.create(baseUri + queryStr.toString());
+ }
+}
diff --git a/components/camel/camel-rss/src/main/java/org/switchyard/component/camel/rss/model/v2/V2CamelRSSModelMarshaller.java b/components/camel/camel-rss/src/main/java/org/switchyard/component/camel/rss/model/v2/V2CamelRSSModelMarshaller.java
new file mode 100644
index 000000000..448d8480f
--- /dev/null
+++ b/components/camel/camel-rss/src/main/java/org/switchyard/component/camel/rss/model/v2/V2CamelRSSModelMarshaller.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.rss.model.v2;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelMarshaller;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+import org.switchyard.config.model.composite.BindingModel;
+
+/**
+ * Atom model marshaller.
+ */
+public class V2CamelRSSModelMarshaller extends V1BaseCamelMarshaller {
+
+ private static final String BINDING_RSS = BindingModel.BINDING + '.' + V2CamelRSSBindingModel.RSS;
+
+ /**
+ * Creates new marshaller.
+ *
+ * @param desc Descriptor
+ */
+ public V2CamelRSSModelMarshaller(Descriptor desc) {
+ super(desc);
+ }
+
+ /**
+ * Reads in the Configuration, looking for various knowledge models.
+ * If not found, it falls back to the super class (V2BaseCamelMarshaller).
+ *
+ * @param config the Configuration
+ * @return the Model
+ */
+ @Override
+ public Model read(Configuration config) {
+ String name = config.getName();
+ Descriptor desc = getDescriptor();
+ if (BINDING_RSS.equals(name)) {
+ return new V2CamelRSSBindingModel(config, desc);
+ }
+ return super.read(config);
+ }
+
+}
diff --git a/components/camel/camel-rss/src/main/resources/META-INF/services/org.switchyard.deploy.Component b/components/camel/camel-rss/src/main/resources/META-INF/services/org.switchyard.deploy.Component
new file mode 100644
index 000000000..370658dc6
--- /dev/null
+++ b/components/camel/camel-rss/src/main/resources/META-INF/services/org.switchyard.deploy.Component
@@ -0,0 +1 @@
+org.switchyard.component.camel.rss.deploy.CamelRSSComponent
diff --git a/components/camel/camel-rss/src/main/resources/org/switchyard/component/camel/rss/model/v2/camel-rss_2_0.xsd b/components/camel/camel-rss/src/main/resources/org/switchyard/component/camel/rss/model/v2/camel-rss_2_0.xsd
new file mode 100644
index 000000000..1be739cb7
--- /dev/null
+++ b/components/camel/camel-rss/src/main/resources/org/switchyard/component/camel/rss/model/v2/camel-rss_2_0.xsd
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-rss/src/main/resources/org/switchyard/config/model/descriptor.properties b/components/camel/camel-rss/src/main/resources/org/switchyard/config/model/descriptor.properties
new file mode 100644
index 000000000..9d86ef5c0
--- /dev/null
+++ b/components/camel/camel-rss/src/main/resources/org/switchyard/config/model/descriptor.properties
@@ -0,0 +1,18 @@
+# Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+
+camel_rss_2_0.section=urn:switchyard-component-camel-rss:config
+camel_rss_2_0.version=2.0
+camel_rss_2_0.namespace=urn:switchyard-component-camel-rss:config:2.0
+camel_rss_2_0.schema=camel-rss_2_0.xsd
+camel_rss_2_0.location=/org/switchyard/component/camel/rss/model/v2/
+camel_rss_2_0.marshaller=org.switchyard.component.camel.rss.model.v2.V2CamelRSSModelMarshaller
diff --git a/components/camel/camel-rss/src/test/java/org/switchyard/component/camel/rss/model/v2/V2CamelRSSBindingModelTest.java b/components/camel/camel-rss/src/test/java/org/switchyard/component/camel/rss/model/v2/V2CamelRSSBindingModelTest.java
new file mode 100644
index 000000000..5040e03d7
--- /dev/null
+++ b/components/camel/camel-rss/src/test/java/org/switchyard/component/camel/rss/model/v2/V2CamelRSSBindingModelTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.rss.model.v2;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.net.URI;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.camel.component.feed.FeedEndpoint;
+import org.switchyard.component.camel.common.model.consumer.CamelScheduledPollConsumer;
+import org.switchyard.component.camel.common.model.v1.V1CamelScheduledPollConsumer;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.rss.model.CamelRSSNamespace;
+import org.switchyard.component.camel.rss.model.v2.V2CamelRSSBindingModel;
+
+/**
+ * Test of rss binding model.
+ */
+public class V2CamelRSSBindingModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v2/switchyard-rss-binding.xml";
+
+ private static final String CAMEL_URI =
+ "rss://file:///dev/null?feedHeader=true&filter=true&lastUpdate=2011-01-01T12:00:00"
+ + "&sortEntries=true&splitEntries=true&throttleEntries=true"
+ + "&delay=15000&initialDelay=20000&useFixedDelay=true";
+
+ private Date referenceDate;
+ private static final URI FEED_URI = URI.create("file:///dev/null");
+ private static final Boolean FEED_HEADER = true;
+ private static final Boolean FILTERED = true;
+ private static final Boolean SORTED = true;
+ private static final Boolean SPLIT = true;
+ private static final Boolean THROTTLED = true;
+
+ public V2CamelRSSBindingModelTest() throws ParseException {
+ super(FeedEndpoint.class, CAMEL_XML);
+
+ referenceDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss")
+ .parse("2011-01-01T12:00:00");
+ }
+
+
+ @Override
+ protected void createModelAssertions(V2CamelRSSBindingModel model) {
+ assertEquals(FEED_URI, model.getFeedURI());
+ assertEquals(referenceDate.toString(), model.getLastUpdate().toString());
+ assertEquals(FEED_HEADER, model.isFeedHeader());
+ assertEquals(FILTERED, model.isFilter());
+ assertEquals(SORTED, model.isSortEntries());
+ assertEquals(SPLIT, model.isSplitEntries());
+ assertEquals(THROTTLED, model.isThrottleEntries());
+ }
+
+ @Override
+ protected V2CamelRSSBindingModel createTestModel() {
+ V2CamelRSSBindingModel abm = new V2CamelRSSBindingModel(CamelRSSNamespace.V_2_0.uri())
+ .setFeedURI(FEED_URI)
+ .setSplitEntries(SPLIT)
+ .setFilter(FILTERED)
+ .setLastUpdate(referenceDate)
+ .setThrottleEntries(THROTTLED)
+ .setFeedHeader(FEED_HEADER)
+ .setSortEntries(SORTED);
+
+ CamelScheduledPollConsumer consumer = new V1CamelScheduledPollConsumer(CamelRSSNamespace.V_2_0.uri(), V2CamelRSSBindingModel.CONSUME)
+ .setInitialDelay(20000)
+ .setDelay(15000)
+ .setUseFixedDelay(true);
+ return abm.setConsumer(consumer);
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-rss/src/test/resources/v2/switchyard-rss-binding.xml b/components/camel/camel-rss/src/test/resources/v2/switchyard-rss-binding.xml
new file mode 100644
index 000000000..fbce9e49e
--- /dev/null
+++ b/components/camel/camel-rss/src/test/resources/v2/switchyard-rss-binding.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+ file:///dev/null
+ true
+ true
+ 2011-01-01T12:00:00
+ true
+ true
+ true
+
+ 20000
+ 15000
+ true
+
+
+
+
+
diff --git a/components/camel/camel-sap/pom.xml b/components/camel/camel-sap/pom.xml
new file mode 100644
index 000000000..87c6c6a70
--- /dev/null
+++ b/components/camel/camel-sap/pom.xml
@@ -0,0 +1,59 @@
+
+
+
+ 4.0.0
+
+ org.switchyard.components
+ switchyard-component-camel-parent
+ 2.1.0-SNAPSHOT
+
+ switchyard-component-camel-sap
+ bundle
+ SwitchYard: Camel Component :: SAP JCO Binding
+ http://switchyard.org
+
+
+ org.switchyard.component.camel.sap.*
+
+
+ org.fusesource.camel.component.sap.*,
+ org.switchyard.config.model;org.switchyard.*;${switchyard.osgi.import.switchyard.version},
+ *
+
+
+
+
+ org.switchyard
+ switchyard-config
+
+
+ org.switchyard.components
+ switchyard-component-common-camel
+
+
+ org.switchyard.components
+ switchyard-component-camel-switchyard
+
+
+ org.fusesource
+ camel-sap
+
+
+ org.switchyard.components
+ switchyard-component-camel-test
+ test
+
+
+
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/deploy/CamelSapComponent.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/deploy/CamelSapComponent.java
new file mode 100644
index 000000000..b3e4cab97
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/deploy/CamelSapComponent.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.deploy;
+
+import org.switchyard.component.camel.common.deploy.BaseBindingComponent;
+import org.switchyard.component.camel.sap.model.v2.Constants;
+
+/**
+ * Camel sap component.
+ */
+public class CamelSapComponent extends BaseBindingComponent {
+
+ /**
+ * Creates new component.
+ */
+ public CamelSapComponent() {
+ super("CamelSapComponent", Constants.SAP);
+ }
+
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/CamelSapBindingModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/CamelSapBindingModel.java
new file mode 100644
index 000000000..51510fdd1
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/CamelSapBindingModel.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model;
+
+import org.switchyard.component.camel.common.model.CamelBindingModel;
+
+/**
+ * Camel SAP binding model.
+ */
+public interface CamelSapBindingModel extends CamelBindingModel {
+
+ /**
+ * Gets endpoint.
+ * @return server
+ */
+ EndpointModel getEndpointModel();
+
+ /**
+ * Sets endpoint.
+ * @param endpoint endpoint
+ * @return this BindingModel (useful for chaining)
+ */
+ CamelSapBindingModel setEndpointModel(EndpointModel endpoint);
+
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/CamelSapNamespace.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/CamelSapNamespace.java
new file mode 100644
index 000000000..ee2bf317b
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/CamelSapNamespace.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model;
+
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Namespace;
+
+/**
+ * A Camel Sap config model namespace.
+ */
+public enum CamelSapNamespace implements Namespace {
+
+ /** The 2.0 namespace. */
+ V_2_0("2.0"),
+ /** The default namespace. */
+ DEFAULT(null);
+
+ private final Util _util;
+
+ /**
+ * Constructs a new CamelSapNamespace with the specified version.
+ * @param version the specified version, or null to discover the default
+ */
+ CamelSapNamespace(String version) {
+ _util = new Util(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String section() {
+ return _util.section();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String version() {
+ return _util.version();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean versionMatches(Namespace namespace) {
+ return _util.versionMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String uri() {
+ return _util.uri();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean uriMatches(Namespace namespace) {
+ return _util.uriMatches(namespace);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDefault() {
+ return this == DEFAULT || uriMatches(DEFAULT);
+ }
+
+ /**
+ * Gets the CamelSapNamespace for the specified uri, or null if no matching uris are found.
+ * @param uri the uri
+ * @return the CamelSqlNamespace
+ */
+ public static CamelSapNamespace fromUri(String uri) {
+ return Util.fromUri(CamelSapNamespace.class, uri);
+ }
+
+ @SuppressWarnings("serial")
+ private static final class Util extends Namespace.Util {
+ // static final since we only want to do the somewhat expensive work of instantiating this once!
+ private static final Descriptor DESCRIPTOR = new Descriptor(CamelSapNamespace.class);
+ private Util(String version) {
+ super(DESCRIPTOR, "urn:switchyard-component-camel-sap:config", version);
+ }
+ }
+
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/DestinationModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/DestinationModel.java
new file mode 100644
index 000000000..0c9060ffa
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/DestinationModel.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model;
+
+/**
+ * camel-sap destination model.
+ */
+public interface DestinationModel extends EndpointModel {
+ /**
+ * Gets destination name.
+ * @return destination name
+ */
+ public String getDestinationName();
+
+ /**
+ * Sets destination name.
+ * @param destination destination
+ * @return this model (useful for chaining)
+ */
+ public DestinationModel setDestinationName(String destination);
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/EndpointModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/EndpointModel.java
new file mode 100644
index 000000000..db7fa5439
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/EndpointModel.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.config.model.Model;
+
+/**
+ * camel-sap endpoint model.
+ */
+public interface EndpointModel extends Model {
+ /**
+ * Gets schema.
+ * @return schema
+ */
+ public String getSchema();
+
+ /**
+ * Gets name.
+ * @return name
+ */
+ public String getName();
+
+ /**
+ * Sets name.
+ * @param name name
+ * @return this model (useful for chaining)
+ */
+ public EndpointModel setName(String name);
+
+ /**
+ * Gets base URI string.
+ * @param queryString query string
+ * @return base URI string
+ */
+ public StringBuilder createBaseURIString(QueryString queryString);
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/IDocDestinationModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/IDocDestinationModel.java
new file mode 100644
index 000000000..1a60dc13d
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/IDocDestinationModel.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model;
+
+/**
+ * camel-sap IDoc destination model.
+ */
+public interface IDocDestinationModel extends DestinationModel {
+ /**
+ * Gets IDoc type.
+ * @return IDoc type
+ */
+ public String getIdocType();
+
+ /**
+ * Sets IDoc type.
+ * @param idoc IDoc type
+ * @return this model (useful for chaining)
+ */
+ public IDocDestinationModel setIdocType(String idoc);
+
+ /**
+ * Gets IDoc type extension.
+ * @return IDoc type extension
+ */
+ public String getIdocTypeExtension();
+
+ /**
+ * Sets IDoc type extension.
+ * @param idocExt IDoc type extension
+ * @return this model (useful for chaiming)
+ */
+ public IDocServerModel setIdocTypeExtension(String idocExt);
+
+ /**
+ * Gets system release.
+ * @return system release
+ */
+ public String getSystemRelease();
+
+ /**
+ * Sets system release.
+ * @param sysRelease system release
+ * @return this model (useful for chaining)
+ */
+ public IDocDestinationModel setSystemRelease(String sysRelease);
+
+ /**
+ * Gets application release.
+ * @return application release
+ */
+ public String getApplicationRelease();
+
+ /**
+ * Sets application release.
+ * @param appRelease application release
+ * @return this model (useful for chaining)
+ */
+ public IDocDestinationModel setApplicationRelease(String appRelease);
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/IDocServerModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/IDocServerModel.java
new file mode 100644
index 000000000..84dc552eb
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/IDocServerModel.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model;
+
+/**
+ * camel-sap IDoc server model.
+ */
+public interface IDocServerModel extends ServerModel {
+ /**
+ * Gets IDoc type.
+ * @return IDoc type.
+ */
+ public String getIdocType();
+
+ /**
+ * Sets IDoc type.
+ * @param idoc IDoc type
+ * @return this model (useful for chaining)
+ */
+ public IDocServerModel setIdocType(String idoc);
+
+ /**
+ * Gets IDoc type extension.
+ * @return IDoc type extension
+ */
+ public String getIdocTypeExtension();
+
+ /**
+ * Sets IDoc type extension.
+ * @param idocExt IDoc type extension
+ * @return this model (useful for chaiming)
+ */
+ public IDocServerModel setIdocTypeExtension(String idocExt);
+
+ /**
+ * Gets system release.
+ * @return system release
+ */
+ public String getSystemRelease();
+
+ /**
+ * Sets system release.
+ * @param sysRelease system release
+ * @return this model (useful for chaining)
+ */
+ public IDocServerModel setSystemRelease(String sysRelease);
+
+ /**
+ * Gets application release.
+ * @return application release
+ */
+ public String getApplicationRelease();
+
+ /**
+ * Sets application release.
+ * @param appRelease application release
+ * @return this model (useful for chaining)
+ */
+ public IDocServerModel setApplicationRelease(String appRelease);
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/QIDocDestinationModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/QIDocDestinationModel.java
new file mode 100644
index 000000000..75d207232
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/QIDocDestinationModel.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model;
+
+/**
+ * camel-sap queued IDoc destination model.
+ */
+public interface QIDocDestinationModel extends IDocDestinationModel {
+ /**
+ * Gets queue name.
+ * @return destination name
+ */
+ public String getQueueName();
+
+ /**
+ * Sets queue name.
+ * @param queue queue name
+ * @return this model (useful for chaining)
+ */
+ public QIDocDestinationModel setQueueName(String queue);
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/QRfcDestinationModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/QRfcDestinationModel.java
new file mode 100644
index 000000000..fca9eb4cf
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/QRfcDestinationModel.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model;
+
+/**
+ * camel-sap destination model.
+ */
+public interface QRfcDestinationModel extends RfcDestinationModel {
+ /**
+ * Gets queue name.
+ * @return destination name
+ */
+ public String getQueueName();
+
+ /**
+ * Sets queue name.
+ * @param queue queue name
+ * @return this model (useful for chaining)
+ */
+ public QRfcDestinationModel setQueueName(String queue);
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/RfcDestinationModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/RfcDestinationModel.java
new file mode 100644
index 000000000..9459a1ced
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/RfcDestinationModel.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model;
+
+/**
+ * camel-sap destination model.
+ */
+public interface RfcDestinationModel extends DestinationModel {
+ /**
+ * Gets RFC name.
+ * @return destination name
+ */
+ public String getRfcName();
+
+ /**
+ * Sets RFC name.
+ * @param rfc RFC name.
+ * @return this model (useful for chaining)
+ */
+ public RfcDestinationModel setRfcName(String rfc);
+
+ /**
+ * Gets if it's transacted.
+ * @return true if it's transacted
+ */
+ public boolean isTransacted();
+
+ /**
+ * Sets if it's transacted.
+ * @param transacted true if it's transacted
+ * @return this model (useful for chaining)
+ */
+ public RfcDestinationModel setTransacted(boolean transacted);
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/RfcServerModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/RfcServerModel.java
new file mode 100644
index 000000000..866dadba6
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/RfcServerModel.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model;
+
+/**
+ * camel-sap RFC server model.
+ */
+public interface RfcServerModel extends ServerModel {
+ /**
+ * Gets RFC name.
+ * @return RFC name
+ */
+ public String getRfcName();
+
+ /**
+ * Sets RFC name.
+ * @param rfc RFC name
+ * @return this model (useful for chaining)
+ */
+ public RfcServerModel setRfcName(String rfc);
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/ServerModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/ServerModel.java
new file mode 100644
index 000000000..974af0773
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/ServerModel.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model;
+
+/**
+ * camel-sap server model.
+ */
+public interface ServerModel extends EndpointModel {
+ /**
+ * Gets server name.
+ * @return server name
+ */
+ public String getServerName();
+
+ /**
+ * Sets server name.
+ * @param server server name
+ * @return this model (useful for chaining)
+ */
+ public ServerModel setServerName(String server);
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/Constants.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/Constants.java
new file mode 100644
index 000000000..2fc607920
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/Constants.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import org.switchyard.config.model.composite.BindingModel;
+
+/**
+ * V2 camel-sap constants.
+ */
+public final class Constants {
+
+ private Constants() {
+ }
+
+ /** sap. */
+ public static final String SAP = "sap";
+ /** binding.sap. */
+ public static final String BINDING_SAP = BindingModel.BINDING + "." + SAP;
+
+ /** idoclist-server. */
+ public static final String IDOCLIST_SERVER = "idoclist-server";
+ /** srfc-server. */
+ public static final String SRFC_SERVER = "srfc-server";
+ /** trfc-server. */
+ public static final String TRFC_SERVER = "trfc-server";
+ /** idoc-destination. */
+ public static final String IDOC_DESTINATION = "idoc-destination";
+ /** idoclist-destination. */
+ public static final String IDOCLIST_DESTINATION = "idoclist-destination";
+ /** qidoc-destination. */
+ public static final String QIDOC_DESTINATION = "qidoc-destination";
+ /** qidoclist-destination. */
+ public static final String QIDOCLIST_DESTINATION = "qidoclist-destination";
+ /** qrfc-destination. */
+ public static final String QRFC_DESTINATION = "qrfc-destination";
+ /** srfc-destination. */
+ public static final String SRFC_DESTINATION = "srfc-destination";
+ /** trfc-destination. */
+ public static final String TRFC_DESTINATION = "trfc-destination";
+
+ /** serverName. */
+ public static final String SERVER_NAME = "serverName";
+ /** destinationName. */
+ public static final String DESTINATION_NAME = "destinationName";
+ /** rfcName. */
+ public static final String RFC_NAME = "rfcName";
+ /** queueName. */
+ public static final String QUEUE_NAME = "queueName";
+ /** idocType. */
+ public static final String IDOC_TYPE = "idocType";
+ /** idocTypeExtension. */
+ public static final String IDOC_TYPE_EXTENSION = "idocTypeExtension";
+ /** systemRelease. */
+ public static final String SYSTEM_RELEASE = "systemRelease";
+ /** applicationRelease. */
+ public static final String APPLICATION_RELEASE = "applicationRelease";
+ /** transacted. */
+ public static final String TRANSACTED = "transacted";
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapBindingModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapBindingModel.java
new file mode 100644
index 000000000..c7ddf435e
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapBindingModel.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import java.net.URI;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelBindingModel;
+import org.switchyard.component.camel.sap.model.CamelSapBindingModel;
+import org.switchyard.component.camel.sap.model.CamelSapNamespace;
+import org.switchyard.component.camel.sap.model.EndpointModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+/**
+ * A binding for Camel's sap component.
+ */
+public class V2CamelSapBindingModel extends V1BaseCamelBindingModel implements CamelSapBindingModel {
+
+ /**
+ * Constructor.
+ *
+ * @param config The switchyard configuration instance.
+ * @param desc The switchyard descriptor instance.
+ */
+ public V2CamelSapBindingModel(final Configuration config, final Descriptor desc) {
+ super(config, desc);
+ }
+
+ /**
+ * Create a new V2CamelSapBindingModel.
+ * @param namespace namespace
+ */
+ public V2CamelSapBindingModel(String namespace) {
+ super(Constants.SAP, namespace);
+ setModelChildrenOrder(Constants.IDOCLIST_SERVER, Constants.SRFC_SERVER, Constants.TRFC_SERVER,
+ Constants.IDOC_DESTINATION, Constants.IDOCLIST_DESTINATION, Constants.QIDOC_DESTINATION,
+ Constants.QIDOCLIST_DESTINATION, Constants.QRFC_DESTINATION, Constants.SRFC_DESTINATION,
+ Constants.TRFC_DESTINATION);
+ }
+
+ @Override
+ public EndpointModel getEndpointModel() {
+ for (Model child : getModelChildren()) {
+ if (child instanceof EndpointModel) {
+ return (EndpointModel) child;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public V2CamelSapBindingModel setEndpointModel(EndpointModel endpoint) {
+ for (Model child : getModelChildren()) {
+ if (child instanceof EndpointModel) {
+ EndpointModel endpointChild = EndpointModel.class.cast(child);
+ getModelConfiguration().removeChildren(
+ new QName(CamelSapNamespace.V_2_0.uri(), endpointChild.getName()));
+ break;
+ }
+ }
+ setChildModel(endpoint);
+ return this;
+ }
+
+ @Override
+ public URI getComponentURI() {
+ Configuration modelConfiguration = getModelConfiguration();
+ List children = modelConfiguration.getChildren();
+
+ QueryString queryString = new QueryString();
+ StringBuilder buf = getEndpointModel().createBaseURIString(queryString);
+ traverseConfiguration(children, queryString, getEndpointModel().getName());
+ buf.append(queryString.toString());
+
+ return URI.create(buf.toString());
+ }
+
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapModelMarshaller.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapModelMarshaller.java
new file mode 100644
index 000000000..05bc1b1d7
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapModelMarshaller.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelMarshaller;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+import org.switchyard.config.model.Model;
+
+/**
+ * SAP model marshaller.
+ */
+public class V2CamelSapModelMarshaller extends V1BaseCamelMarshaller {
+
+ /**
+ * Creates new marshaller.
+ *
+ * @param desc Descriptor.
+ */
+ public V2CamelSapModelMarshaller(Descriptor desc) {
+ super(desc);
+ }
+
+ /**
+ * Reads in the Configuration, looking for various models.
+ * If not found, it falls back to the super class (V2BaseCamelMarshaller).
+ *
+ * @param config the Configuration
+ * @return the Model
+ */
+ @Override
+ public Model read(Configuration config) {
+ String name = config.getName();
+ Descriptor desc = getDescriptor();
+ if (Constants.BINDING_SAP.equals(name)) {
+ return new V2CamelSapBindingModel(config, desc);
+ }
+ if (Constants.IDOCLIST_SERVER.equals(name)) {
+ return new V2IDocServerModel(config, desc);
+ }
+ if (Constants.SRFC_SERVER.equals(name) || Constants.TRFC_SERVER.equals(name)) {
+ return new V2RfcServerModel(config, desc);
+ }
+ if (Constants.IDOC_DESTINATION.equals(name) || Constants.IDOCLIST_DESTINATION.equals(name)) {
+ return new V2IDocDestinationModel(config, desc);
+ }
+ if (Constants.QIDOC_DESTINATION.equals(name) || Constants.QIDOCLIST_DESTINATION.equals(name)) {
+ return new V2QIDocDestinationModel(config, desc);
+ }
+ if (Constants.QRFC_DESTINATION.equals(name)) {
+ return new V2QRfcDestinationModel(config, desc);
+ }
+ if (Constants.SRFC_DESTINATION.equals(name) || Constants.TRFC_DESTINATION.equals(name)) {
+ return new V2RfcDestinationModel(config, desc);
+ }
+ return super.read(config);
+ }
+
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2DestinationModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2DestinationModel.java
new file mode 100644
index 000000000..fbc1e767e
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2DestinationModel.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import org.switchyard.component.camel.sap.model.DestinationModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * V2 camel-sap destination model.
+ */
+public abstract class V2DestinationModel extends V2EndpointModel implements DestinationModel {
+
+ protected V2DestinationModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ protected V2DestinationModel(String namespace, String name) {
+ super(namespace, name);
+ }
+
+ @Override
+ public String getDestinationName() {
+ return getConfig(Constants.DESTINATION_NAME);
+ }
+
+ @Override
+ public V2DestinationModel setDestinationName(String destination) {
+ setConfig(Constants.DESTINATION_NAME, destination);
+ return this;
+ }
+
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2EndpointModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2EndpointModel.java
new file mode 100644
index 000000000..bc8502936
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2EndpointModel.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import org.switchyard.component.camel.common.model.v1.V1BaseCamelModel;
+import org.switchyard.component.camel.sap.model.EndpointModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * V2 camel-sap endpoint model.
+ */
+public abstract class V2EndpointModel extends V1BaseCamelModel implements EndpointModel {
+
+ private String _name;
+
+ protected V2EndpointModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ _name = config.getQName().getLocalPart();
+ }
+
+ protected V2EndpointModel(String namespace, String name) {
+ super(namespace, name);
+ _name = name;
+ }
+
+ @Override
+ public String getName() {
+ return _name;
+ }
+
+ @Override
+ public V2EndpointModel setName(String name) {
+ _name = name;
+ return this;
+ }
+
+ @Override
+ public String getSchema() {
+ return Constants.SAP + "-" + _name;
+ }
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2IDocDestinationModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2IDocDestinationModel.java
new file mode 100644
index 000000000..d712f720f
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2IDocDestinationModel.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.sap.model.IDocDestinationModel;
+import org.switchyard.component.camel.sap.model.IDocServerModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * V2 camel-sap IDoc destination model.
+ */
+public class V2IDocDestinationModel extends V2DestinationModel implements IDocDestinationModel {
+
+ /**
+ * Constructor.
+ * @param config configuration
+ * @param desc descriptor
+ */
+ public V2IDocDestinationModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ /**
+ * Constructor.
+ * @param namespace namespace
+ * @param name name
+ */
+ public V2IDocDestinationModel(String namespace, String name) {
+ super(namespace, name);
+ setModelChildrenOrder(Constants.DESTINATION_NAME, Constants.IDOC_TYPE,
+ Constants.IDOC_TYPE_EXTENSION, Constants.SYSTEM_RELEASE, Constants.APPLICATION_RELEASE);
+ }
+
+ @Override
+ public String getIdocType() {
+ return getConfig(Constants.IDOC_TYPE);
+ }
+
+ @Override
+ public IDocDestinationModel setIdocType(String idoc) {
+ setConfig(Constants.IDOC_TYPE, idoc);
+ return this;
+ }
+
+ @Override
+ public String getIdocTypeExtension() {
+ return getConfig(Constants.IDOC_TYPE_EXTENSION);
+ }
+
+ @Override
+ public IDocServerModel setIdocTypeExtension(String idocExt) {
+ setConfig(Constants.IDOC_TYPE_EXTENSION, idocExt);
+ return null;
+ }
+
+ @Override
+ public String getSystemRelease() {
+ return getConfig(Constants.SYSTEM_RELEASE);
+ }
+
+ @Override
+ public IDocDestinationModel setSystemRelease(String sysRelease) {
+ setConfig(Constants.SYSTEM_RELEASE, sysRelease);
+ return this;
+ }
+
+ @Override
+ public String getApplicationRelease() {
+ return getConfig(Constants.APPLICATION_RELEASE);
+ }
+
+ @Override
+ public IDocDestinationModel setApplicationRelease(String appRelease) {
+ setConfig(Constants.APPLICATION_RELEASE, appRelease);
+ return this;
+ }
+
+ @Override
+ public StringBuilder createBaseURIString(QueryString queryString) {
+ StringBuilder buf = new StringBuilder(getSchema())
+ .append(':').append(getDestinationName())
+ .append(':').append(getIdocType());
+ String idocTypeExt = getIdocTypeExtension();
+ if (idocTypeExt != null && !idocTypeExt.isEmpty()) {
+ buf.append(':').append(idocTypeExt);
+ String sysRel = getSystemRelease();
+ if (sysRel != null && !sysRel.isEmpty()) {
+ buf.append(':').append(sysRel);
+ String appRel = getApplicationRelease();
+ if (appRel != null && !appRel.isEmpty()) {
+ buf.append(':').append(appRel);
+ }
+ }
+ }
+ return buf;
+ }
+
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2IDocServerModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2IDocServerModel.java
new file mode 100644
index 000000000..85af4b5ad
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2IDocServerModel.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.sap.model.IDocServerModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * V2 IDoc server model.
+ */
+public class V2IDocServerModel extends V2ServerModel implements IDocServerModel {
+
+ /**
+ * Constructor.
+ * @param config configuration
+ * @param desc descriptor
+ */
+ public V2IDocServerModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ /**
+ * Constructor.
+ * @param namespace namespace
+ * @param name name
+ */
+ public V2IDocServerModel(String namespace, String name) {
+ super(namespace, name);
+ setModelChildrenOrder(Constants.SERVER_NAME, Constants.IDOC_TYPE,
+ Constants.IDOC_TYPE_EXTENSION, Constants.SYSTEM_RELEASE, Constants.APPLICATION_RELEASE);
+ }
+
+ @Override
+ public String getIdocType() {
+ return getConfig(Constants.IDOC_TYPE);
+ }
+
+ @Override
+ public IDocServerModel setIdocType(String idoc) {
+ setConfig(Constants.IDOC_TYPE, idoc);
+ return this;
+ }
+
+ @Override
+ public String getIdocTypeExtension() {
+ return getConfig(Constants.IDOC_TYPE_EXTENSION);
+ }
+
+ @Override
+ public IDocServerModel setIdocTypeExtension(String idocExt) {
+ setConfig(Constants.IDOC_TYPE_EXTENSION, idocExt);
+ return this;
+ }
+
+ @Override
+ public String getSystemRelease() {
+ return getConfig(Constants.SYSTEM_RELEASE);
+ }
+
+ @Override
+ public IDocServerModel setSystemRelease(String sysRelease) {
+ setConfig(Constants.SYSTEM_RELEASE, sysRelease);
+ return null;
+ }
+
+ @Override
+ public String getApplicationRelease() {
+ return getConfig(Constants.APPLICATION_RELEASE);
+ }
+
+ @Override
+ public IDocServerModel setApplicationRelease(String appRelease) {
+ setConfig(Constants.APPLICATION_RELEASE, appRelease);
+ return this;
+ }
+
+ @Override
+ public StringBuilder createBaseURIString(QueryString queryString) {
+ StringBuilder buf = new StringBuilder(getSchema())
+ .append(':').append(getServerName())
+ .append(':').append(getIdocType());
+ String idocTypeExt = getIdocTypeExtension();
+ if (idocTypeExt != null && !idocTypeExt.isEmpty()) {
+ buf.append(':').append(idocTypeExt);
+ String sysRel = getSystemRelease();
+ if (sysRel != null && !sysRel.isEmpty()) {
+ buf.append(':').append(sysRel);
+ String appRel = getApplicationRelease();
+ if (appRel != null && !appRel.isEmpty()) {
+ buf.append(':').append(appRel);
+ }
+ }
+ }
+ return buf;
+ }
+
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2QIDocDestinationModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2QIDocDestinationModel.java
new file mode 100644
index 000000000..9c96d01ba
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2QIDocDestinationModel.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.sap.model.QIDocDestinationModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * V2 Queued IDoc destination model.
+ */
+public class V2QIDocDestinationModel extends V2IDocDestinationModel implements QIDocDestinationModel {
+
+ /**
+ * Constructor.
+ * @param config configuration
+ * @param desc descriptor
+ */
+ public V2QIDocDestinationModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ /**
+ * Constructor.
+ * @param namespace namespace
+ * @param name name
+ */
+ public V2QIDocDestinationModel(String namespace, String name) {
+ super(namespace, name);
+ setModelChildrenOrder(Constants.DESTINATION_NAME, Constants.QUEUE_NAME, Constants.IDOC_TYPE,
+ Constants.IDOC_TYPE_EXTENSION, Constants.SYSTEM_RELEASE, Constants.APPLICATION_RELEASE);
+ }
+
+ @Override
+ public String getQueueName() {
+ return getConfig(Constants.QUEUE_NAME);
+ }
+
+ @Override
+ public QIDocDestinationModel setQueueName(String queue) {
+ setConfig(Constants.QUEUE_NAME, queue);
+ return this;
+ }
+
+ @Override
+ public StringBuilder createBaseURIString(QueryString queryString) {
+ StringBuilder buf = new StringBuilder(getSchema())
+ .append(':').append(getDestinationName())
+ .append(':').append(getQueueName())
+ .append(':').append(getIdocType());
+ String idocTypeExt = getIdocTypeExtension();
+ if (idocTypeExt != null && !idocTypeExt.isEmpty()) {
+ buf.append(':').append(idocTypeExt);
+ String sysRel = getSystemRelease();
+ if (sysRel != null && !sysRel.isEmpty()) {
+ buf.append(':').append(sysRel);
+ String appRel = getApplicationRelease();
+ if (appRel != null && !appRel.isEmpty()) {
+ buf.append(':').append(appRel);
+ }
+ }
+ }
+ return buf;
+ }
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2QRfcDestinationModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2QRfcDestinationModel.java
new file mode 100644
index 000000000..70aa3a158
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2QRfcDestinationModel.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.sap.model.QRfcDestinationModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * V2 camel-sap Queued RFC destination model.
+ */
+public class V2QRfcDestinationModel extends V2RfcDestinationModel implements QRfcDestinationModel {
+
+ /**
+ * Constructor.
+ * @param config configuration
+ * @param desc descriptor
+ */
+ public V2QRfcDestinationModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ /**
+ * Constructor.
+ * @param namespace namespace
+ * @param name name
+ */
+ public V2QRfcDestinationModel(String namespace, String name) {
+ super(namespace, name);
+ setModelChildrenOrder(Constants.DESTINATION_NAME, Constants.QUEUE_NAME, Constants.RFC_NAME, Constants.TRANSACTED);
+ }
+
+ @Override
+ public String getQueueName() {
+ return getConfig(Constants.QUEUE_NAME);
+ }
+
+ @Override
+ public QRfcDestinationModel setQueueName(String queue) {
+ setConfig(Constants.QUEUE_NAME, queue);
+ return this;
+ }
+
+ @Override
+ public StringBuilder createBaseURIString(QueryString queryString) {
+ queryString.add(Constants.TRANSACTED, isTransacted());
+ return new StringBuilder(getSchema())
+ .append(':').append(getDestinationName())
+ .append(':').append(getQueueName())
+ .append(':').append(getRfcName());
+ }
+
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2RfcDestinationModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2RfcDestinationModel.java
new file mode 100644
index 000000000..1213dac9f
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2RfcDestinationModel.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.sap.model.RfcDestinationModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * V2 camel-sap RFC destination model.
+ */
+public class V2RfcDestinationModel extends V2DestinationModel implements RfcDestinationModel {
+
+ /**
+ * Constructor.
+ * @param config configuration
+ * @param desc descriptor
+ */
+ public V2RfcDestinationModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ /**
+ * Constructor.
+ * @param namespace namespace
+ * @param name name
+ */
+ public V2RfcDestinationModel(String namespace, String name) {
+ super(namespace, name);
+ setModelChildrenOrder(Constants.DESTINATION_NAME, Constants.RFC_NAME, Constants.TRANSACTED);
+ }
+
+ @Override
+ public String getRfcName() {
+ return getConfig(Constants.RFC_NAME);
+ }
+
+ @Override
+ public V2RfcDestinationModel setRfcName(String rfc) {
+ setConfig(Constants.RFC_NAME, rfc);
+ return this;
+ }
+
+ @Override
+ public boolean isTransacted() {
+ return getBooleanConfig(Constants.TRANSACTED);
+ }
+
+ @Override
+ public V2RfcDestinationModel setTransacted(boolean transacted) {
+ setConfig(Constants.TRANSACTED, transacted);
+ return this;
+ }
+
+ @Override
+ public StringBuilder createBaseURIString(QueryString queryString) {
+ queryString.add(Constants.TRANSACTED, isTransacted());
+ return new StringBuilder(getSchema())
+ .append(':').append(getDestinationName())
+ .append(':').append(getRfcName());
+ }
+
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2RfcServerModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2RfcServerModel.java
new file mode 100644
index 000000000..80841a9b6
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2RfcServerModel.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import org.switchyard.component.camel.common.QueryString;
+import org.switchyard.component.camel.sap.model.RfcServerModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * V2 RFC server model.
+ */
+public class V2RfcServerModel extends V2ServerModel implements RfcServerModel {
+
+ /**
+ * Constructor.
+ * @param config configuration
+ * @param desc descriptor
+ */
+ public V2RfcServerModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ /**
+ * Constructor.
+ * @param namespace namespace
+ * @param name name
+ */
+ public V2RfcServerModel(String namespace, String name) {
+ super(namespace, name);
+ setModelChildrenOrder(Constants.SERVER_NAME, Constants.RFC_NAME);
+ }
+
+ @Override
+ public String getRfcName() {
+ return getConfig(Constants.RFC_NAME);
+ }
+
+ @Override
+ public V2RfcServerModel setRfcName(String rfc) {
+ setConfig(Constants.RFC_NAME, rfc);
+ return this;
+ }
+
+ @Override
+ public StringBuilder createBaseURIString(QueryString queryString) {
+ return new StringBuilder(getSchema())
+ .append(':').append(getServerName())
+ .append(':').append(getRfcName());
+ }
+
+}
diff --git a/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2ServerModel.java b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2ServerModel.java
new file mode 100644
index 000000000..6dc21433b
--- /dev/null
+++ b/components/camel/camel-sap/src/main/java/org/switchyard/component/camel/sap/model/v2/V2ServerModel.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import org.switchyard.component.camel.sap.model.ServerModel;
+import org.switchyard.config.Configuration;
+import org.switchyard.config.model.Descriptor;
+
+/**
+ * V2 camel-sap server model.
+ */
+public abstract class V2ServerModel extends V2EndpointModel implements ServerModel {
+
+ protected V2ServerModel(Configuration config, Descriptor desc) {
+ super(config, desc);
+ }
+
+ protected V2ServerModel(String namespace, String name) {
+ super(namespace, name);
+ }
+
+ @Override
+ public String getServerName() {
+ return getConfig(Constants.SERVER_NAME);
+ }
+
+ @Override
+ public V2ServerModel setServerName(String server) {
+ setConfig(Constants.SERVER_NAME, server);
+ return this;
+ }
+
+}
diff --git a/components/camel/camel-sap/src/main/resources/META-INF/services/org.switchyard.deploy.Component b/components/camel/camel-sap/src/main/resources/META-INF/services/org.switchyard.deploy.Component
new file mode 100644
index 000000000..0dca65463
--- /dev/null
+++ b/components/camel/camel-sap/src/main/resources/META-INF/services/org.switchyard.deploy.Component
@@ -0,0 +1 @@
+org.switchyard.component.camel.sap.deploy.CamelSapComponent
diff --git a/components/camel/camel-sap/src/main/resources/META-INF/services/org/apache/camel/TypeConverter b/components/camel/camel-sap/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
new file mode 100644
index 000000000..80bbd4806
--- /dev/null
+++ b/components/camel/camel-sap/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
@@ -0,0 +1,18 @@
+#
+# Copyright 2013 Red Hat, Inc.
+#
+# Red Hat 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.
+
+# This is a workaround for the original TypeConverter file which doesn't work on JBoss
+# The original file contains a package name, but the converter is not loaded properly.
+org.fusesource.camel.component.sap.converter.StructureConverter
diff --git a/components/camel/camel-sap/src/main/resources/org/switchyard/component/camel/sap/model/v2/camel-sap_2_0.xsd b/components/camel/camel-sap/src/main/resources/org/switchyard/component/camel/sap/model/v2/camel-sap_2_0.xsd
new file mode 100644
index 000000000..114355bd8
--- /dev/null
+++ b/components/camel/camel-sap/src/main/resources/org/switchyard/component/camel/sap/model/v2/camel-sap_2_0.xsd
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+
+
+
+
+ SAP Binding configuration. *-server is for service binding, and *-destination is for reference binding.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/camel/camel-sap/src/main/resources/org/switchyard/config/model/descriptor.properties b/components/camel/camel-sap/src/main/resources/org/switchyard/config/model/descriptor.properties
new file mode 100644
index 000000000..50fbaeabf
--- /dev/null
+++ b/components/camel/camel-sap/src/main/resources/org/switchyard/config/model/descriptor.properties
@@ -0,0 +1,18 @@
+# Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+#
+# 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.
+
+camel_sap_2_0.section=urn:switchyard-component-camel-sap:config
+camel_sap_2_0.version=2.0
+camel_sap_2_0.namespace=urn:switchyard-component-camel-sap:config:2.0
+camel_sap_2_0.schema=camel-sap_2_0.xsd
+camel_sap_2_0.location=/org/switchyard/component/camel/sap/model/v2
+camel_sap_2_0.marshaller=org.switchyard.component.camel.sap.model.v2.V2CamelSapModelMarshaller
diff --git a/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapIDocDestinationModelTest.java b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapIDocDestinationModelTest.java
new file mode 100644
index 000000000..e7d9cd322
--- /dev/null
+++ b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapIDocDestinationModelTest.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import static org.junit.Assert.assertEquals;
+
+import org.fusesource.camel.component.sap.SapTransactionalIDocDestinationEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelReferenceBindingModelTest;
+import org.switchyard.component.camel.sap.model.CamelSapNamespace;
+import org.switchyard.component.camel.sap.model.EndpointModel;
+
+/**
+ * Test for {@link V2CamelSapIDocDestinationModel}.
+ */
+public class V2CamelSapIDocDestinationModelTest extends V1BaseCamelReferenceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v2/switchyard-sap-idoc-destination-beans.xml";
+ private static final String ENDPOINT_TYPE = Constants.IDOC_DESTINATION;
+ private static final String DESTINATION_NAME = "nplHost";
+ private static final String IDOC_TYPE = "BAPI_FLTRIP_GETLIST";
+ private static final String IDOC_TYPE_EXTENSION = "IDOC_TYPE_EXTENSION";
+ private static final String SYSTEM_RELEASE = "SYSTEM_RELEASE";
+ private static final String APPLICATION_RELEASE = "APPLICATION_RELEASE";
+ private static final String CAMEL_URI = "sap-" + ENDPOINT_TYPE + ":" + DESTINATION_NAME + ":" + IDOC_TYPE
+ + ":" + IDOC_TYPE_EXTENSION + ":" + SYSTEM_RELEASE + ":" + APPLICATION_RELEASE;
+
+ public V2CamelSapIDocDestinationModelTest() {
+ super(SapTransactionalIDocDestinationEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V2CamelSapBindingModel createTestModel() {
+ V2CamelSapBindingModel binding =
+ new V2CamelSapBindingModel(CamelSapNamespace.V_2_0.uri()) {
+ @Override
+ public boolean isReferenceBinding() {
+ return true;
+ }
+ };
+ V2IDocDestinationModel endpoint = new V2IDocDestinationModel(CamelSapNamespace.V_2_0.uri(),
+ Constants.IDOC_DESTINATION);
+ endpoint.setDestinationName(DESTINATION_NAME);
+ endpoint.setIdocType(IDOC_TYPE);
+ endpoint.setIdocTypeExtension(IDOC_TYPE_EXTENSION);
+ endpoint.setSystemRelease(SYSTEM_RELEASE);
+ endpoint.setApplicationRelease(APPLICATION_RELEASE);
+ return binding.setEndpointModel(endpoint);
+ }
+
+ @Override
+ protected void createModelAssertions(V2CamelSapBindingModel model) {
+ EndpointModel endpoint = model.getEndpointModel();
+ assertEquals(ENDPOINT_TYPE, endpoint.getName());
+ assertEquals(V2IDocDestinationModel.class, endpoint.getClass());
+ V2IDocDestinationModel idocDest = V2IDocDestinationModel.class.cast(endpoint);
+ assertEquals(DESTINATION_NAME, idocDest.getDestinationName());
+ assertEquals(IDOC_TYPE, idocDest.getIdocType());
+ assertEquals(IDOC_TYPE_EXTENSION, idocDest.getIdocTypeExtension());
+ assertEquals(SYSTEM_RELEASE, idocDest.getSystemRelease());
+ assertEquals(APPLICATION_RELEASE, idocDest.getApplicationRelease());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapIDocListDestinationModelTest.java b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapIDocListDestinationModelTest.java
new file mode 100644
index 000000000..6f6179292
--- /dev/null
+++ b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapIDocListDestinationModelTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import static org.junit.Assert.assertEquals;
+
+import org.fusesource.camel.component.sap.SapTransactionalIDocListDestinationEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelReferenceBindingModelTest;
+import org.switchyard.component.camel.sap.model.CamelSapNamespace;
+import org.switchyard.component.camel.sap.model.EndpointModel;
+
+/**
+ * Test for {@link V2CamelSapIDocListDestinationModel}.
+ */
+public class V2CamelSapIDocListDestinationModelTest extends V1BaseCamelReferenceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v2/switchyard-sap-idoclist-destination-beans.xml";
+ private static final String ENDPOINT_TYPE = Constants.IDOCLIST_DESTINATION;
+ private static final String DESTINATION_NAME = "nplHost";
+ private static final String IDOC_TYPE = "BAPI_FLTRIP_GETLIST";
+ private static final String IDOC_TYPE_EXTENSION = "IDOC_TYPE_EXTENSION";
+ private static final String SYSTEM_RELEASE = "SYSTEM_RELEASE";
+ private static final String CAMEL_URI = "sap-" + ENDPOINT_TYPE + ":" + DESTINATION_NAME + ":" + IDOC_TYPE
+ + ":" + IDOC_TYPE_EXTENSION + ":" + SYSTEM_RELEASE;
+
+ public V2CamelSapIDocListDestinationModelTest() {
+ super(SapTransactionalIDocListDestinationEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V2CamelSapBindingModel createTestModel() {
+ V2CamelSapBindingModel binding =
+ new V2CamelSapBindingModel(CamelSapNamespace.V_2_0.uri()) {
+ @Override
+ public boolean isReferenceBinding() {
+ return true;
+ }
+ };
+ V2IDocDestinationModel endpoint = new V2IDocDestinationModel(CamelSapNamespace.V_2_0.uri(),
+ Constants.IDOCLIST_DESTINATION);
+ endpoint.setDestinationName(DESTINATION_NAME);
+ endpoint.setIdocType(IDOC_TYPE);
+ endpoint.setIdocTypeExtension(IDOC_TYPE_EXTENSION);
+ endpoint.setSystemRelease(SYSTEM_RELEASE);
+ return binding.setEndpointModel(endpoint);
+ }
+
+ @Override
+ protected void createModelAssertions(V2CamelSapBindingModel model) {
+ EndpointModel endpoint = model.getEndpointModel();
+ assertEquals(ENDPOINT_TYPE, endpoint.getName());
+ assertEquals(V2IDocDestinationModel.class, endpoint.getClass());
+ V2IDocDestinationModel idocDest = V2IDocDestinationModel.class.cast(endpoint);
+ assertEquals(DESTINATION_NAME, idocDest.getDestinationName());
+ assertEquals(IDOC_TYPE, idocDest.getIdocType());
+ assertEquals(IDOC_TYPE_EXTENSION, idocDest.getIdocTypeExtension());
+ assertEquals(SYSTEM_RELEASE, idocDest.getSystemRelease());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapIDocListServerModelTest.java b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapIDocListServerModelTest.java
new file mode 100644
index 000000000..3017a04ee
--- /dev/null
+++ b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapIDocListServerModelTest.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import static org.junit.Assert.assertEquals;
+
+import org.fusesource.camel.component.sap.SapTransactionalIDocListServerEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.sap.model.CamelSapNamespace;
+import org.switchyard.component.camel.sap.model.EndpointModel;
+
+/**
+ * Test for {@link V2CamelSapIDocListServerModel}.
+ */
+public class V2CamelSapIDocListServerModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v2/switchyard-sap-idoclist-server-beans.xml";
+ private static final String ENDPOINT_TYPE = Constants.IDOCLIST_SERVER;
+ private static final String SERVER_NAME = "nplserver";
+ private static final String IDOC_TYPE = "BOOK_FLIGHT";
+ private static final String IDOC_TYPE_EXTENSION = "IDOC_TYPE_EXTENSION";
+ private static final String SYSTEM_RELEASE = "SYSTEM_RELEASE";
+ private static final String APPLICATION_RELEASE = "APPLICATION_RELEASE";
+ private static final String CAMEL_URI = "sap-" + ENDPOINT_TYPE + ":" + SERVER_NAME + ":" + IDOC_TYPE
+ + ":" + IDOC_TYPE_EXTENSION + ":" + SYSTEM_RELEASE + ":" + APPLICATION_RELEASE;
+
+ public V2CamelSapIDocListServerModelTest() {
+ super(SapTransactionalIDocListServerEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V2CamelSapBindingModel createTestModel() {
+ V2IDocServerModel endpoint = new V2IDocServerModel(CamelSapNamespace.V_2_0.uri(), Constants.IDOCLIST_SERVER);
+ endpoint.setServerName(SERVER_NAME);
+ endpoint.setIdocType(IDOC_TYPE);
+ endpoint.setIdocTypeExtension(IDOC_TYPE_EXTENSION);
+ endpoint.setSystemRelease(SYSTEM_RELEASE);
+ endpoint.setApplicationRelease(APPLICATION_RELEASE);
+ return new V2CamelSapBindingModel(CamelSapNamespace.V_2_0.uri()).setEndpointModel(endpoint);
+ }
+
+ @Override
+ protected void createModelAssertions(V2CamelSapBindingModel model) {
+ EndpointModel endpoint = model.getEndpointModel();
+ assertEquals(ENDPOINT_TYPE, endpoint.getName());
+ assertEquals(V2IDocServerModel.class, endpoint.getClass());
+ V2IDocServerModel idocServer = V2IDocServerModel.class.cast(endpoint);
+ assertEquals(SERVER_NAME, idocServer.getServerName());
+ assertEquals(IDOC_TYPE, idocServer.getIdocType());
+ assertEquals(IDOC_TYPE_EXTENSION, idocServer.getIdocTypeExtension());
+ assertEquals(SYSTEM_RELEASE, idocServer.getSystemRelease());
+ assertEquals(APPLICATION_RELEASE, idocServer.getApplicationRelease());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapQIDocDestinationModelTest.java b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapQIDocDestinationModelTest.java
new file mode 100644
index 000000000..a3f63e99b
--- /dev/null
+++ b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapQIDocDestinationModelTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import static org.junit.Assert.assertEquals;
+
+import org.fusesource.camel.component.sap.SapQueuedIDocDestinationEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelReferenceBindingModelTest;
+import org.switchyard.component.camel.sap.model.CamelSapNamespace;
+import org.switchyard.component.camel.sap.model.EndpointModel;
+
+/**
+ * Test for {@link V2CamelSapQIDocDestinationModel}.
+ */
+public class V2CamelSapQIDocDestinationModelTest extends V1BaseCamelReferenceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v2/switchyard-sap-qidoc-destination-beans.xml";
+ private static final String ENDPOINT_TYPE = Constants.QIDOC_DESTINATION;
+ private static final String DESTINATION_NAME = "nplHost";
+ private static final String QUEUE_NAME = "QUEUE_NAME";
+ private static final String IDOC_TYPE = "BAPI_FLTRIP_GETLIST";
+ private static final String IDOC_TYPE_EXTENSION = "IDOC_TYPE_EXTENSION";
+ private static final String CAMEL_URI = "sap-" + ENDPOINT_TYPE + ":" + DESTINATION_NAME
+ + ":" + QUEUE_NAME + ":" + IDOC_TYPE + ":" + IDOC_TYPE_EXTENSION;
+
+ public V2CamelSapQIDocDestinationModelTest() {
+ super(SapQueuedIDocDestinationEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V2CamelSapBindingModel createTestModel() {
+ V2CamelSapBindingModel binding =
+ new V2CamelSapBindingModel(CamelSapNamespace.V_2_0.uri()) {
+ @Override
+ public boolean isReferenceBinding() {
+ return true;
+ }
+ };
+ V2QIDocDestinationModel endpoint = new V2QIDocDestinationModel(CamelSapNamespace.V_2_0.uri(),
+ Constants.QIDOC_DESTINATION);
+ endpoint.setDestinationName(DESTINATION_NAME);
+ endpoint.setQueueName(QUEUE_NAME);
+ endpoint.setIdocType(IDOC_TYPE);
+ endpoint.setIdocTypeExtension(IDOC_TYPE_EXTENSION);
+ return binding.setEndpointModel(endpoint);
+ }
+
+ @Override
+ protected void createModelAssertions(V2CamelSapBindingModel model) {
+ EndpointModel endpoint = model.getEndpointModel();
+ assertEquals(ENDPOINT_TYPE, endpoint.getName());
+ assertEquals(V2QIDocDestinationModel.class, endpoint.getClass());
+ V2QIDocDestinationModel qidocDest = V2QIDocDestinationModel.class.cast(endpoint);
+ assertEquals(DESTINATION_NAME, qidocDest.getDestinationName());
+ assertEquals(QUEUE_NAME, qidocDest.getQueueName());
+ assertEquals(IDOC_TYPE, qidocDest.getIdocType());
+ assertEquals(IDOC_TYPE_EXTENSION, qidocDest.getIdocTypeExtension());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapQIDocListDestinationModelTest.java b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapQIDocListDestinationModelTest.java
new file mode 100644
index 000000000..cc853d3b1
--- /dev/null
+++ b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapQIDocListDestinationModelTest.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import static org.junit.Assert.assertEquals;
+
+import org.fusesource.camel.component.sap.SapQueuedIDocListDestinationEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelReferenceBindingModelTest;
+import org.switchyard.component.camel.sap.model.CamelSapNamespace;
+import org.switchyard.component.camel.sap.model.EndpointModel;
+
+/**
+ * Test for {@link V2CamelSapQIDocListDestinationModel}.
+ */
+public class V2CamelSapQIDocListDestinationModelTest extends V1BaseCamelReferenceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v2/switchyard-sap-qidoclist-destination-beans.xml";
+ private static final String ENDPOINT_TYPE = Constants.QIDOCLIST_DESTINATION;
+ private static final String DESTINATION_NAME = "nplHost";
+ private static final String QUEUE_NAME = "QUEUE_NAME";
+ private static final String IDOC_TYPE = "BAPI_FLTRIP_GETLIST";
+ private static final String CAMEL_URI = "sap-" + ENDPOINT_TYPE + ":" + DESTINATION_NAME
+ + ":" + QUEUE_NAME + ":" + IDOC_TYPE;
+
+ public V2CamelSapQIDocListDestinationModelTest() {
+ super(SapQueuedIDocListDestinationEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V2CamelSapBindingModel createTestModel() {
+ V2CamelSapBindingModel binding =
+ new V2CamelSapBindingModel(CamelSapNamespace.V_2_0.uri()) {
+ @Override
+ public boolean isReferenceBinding() {
+ return true;
+ }
+ };
+ V2QIDocDestinationModel endpoint = new V2QIDocDestinationModel(CamelSapNamespace.V_2_0.uri(),
+ Constants.QIDOCLIST_DESTINATION);
+ endpoint.setDestinationName(DESTINATION_NAME);
+ endpoint.setQueueName(QUEUE_NAME);
+ endpoint.setIdocType(IDOC_TYPE);
+ return binding.setEndpointModel(endpoint);
+ }
+
+ @Override
+ protected void createModelAssertions(V2CamelSapBindingModel model) {
+ EndpointModel endpoint = model.getEndpointModel();
+ assertEquals(ENDPOINT_TYPE, endpoint.getName());
+ assertEquals(V2QIDocDestinationModel.class, endpoint.getClass());
+ V2QIDocDestinationModel qidocDest = V2QIDocDestinationModel.class.cast(endpoint);
+ assertEquals(DESTINATION_NAME, qidocDest.getDestinationName());
+ assertEquals(QUEUE_NAME, qidocDest.getQueueName());
+ assertEquals(IDOC_TYPE, qidocDest.getIdocType());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapQRfcDestinationModelTest.java b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapQRfcDestinationModelTest.java
new file mode 100644
index 000000000..ff631841d
--- /dev/null
+++ b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapQRfcDestinationModelTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import static org.junit.Assert.assertEquals;
+
+import org.fusesource.camel.component.sap.SapQueuedRfcDestinationEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelReferenceBindingModelTest;
+import org.switchyard.component.camel.sap.model.CamelSapNamespace;
+import org.switchyard.component.camel.sap.model.EndpointModel;
+
+/**
+ * Test for {@link V2CamelSapQRfcDestinationModel}.
+ */
+public class V2CamelSapQRfcDestinationModelTest extends V1BaseCamelReferenceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v2/switchyard-sap-qrfc-destination-beans.xml";
+ private static final String ENDPOINT_TYPE = Constants.QRFC_DESTINATION;
+ private static final String DESTINATION_NAME = "nplHost";
+ private static final String QUEUE_NAME = "QUEUE_NAME";
+ private static final String RFC_NAME = "BAPI_FLTRIP_GETLIST";
+ private static final Boolean TRANSACTED = Boolean.TRUE;
+ private static final String CAMEL_URI = "sap-" + ENDPOINT_TYPE + ":" + DESTINATION_NAME + ":" + QUEUE_NAME
+ + ":" + RFC_NAME + "?transacted=" + TRANSACTED;
+
+ public V2CamelSapQRfcDestinationModelTest() {
+ super(SapQueuedRfcDestinationEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V2CamelSapBindingModel createTestModel() {
+ V2CamelSapBindingModel binding =
+ new V2CamelSapBindingModel(CamelSapNamespace.V_2_0.uri()) {
+ @Override
+ public boolean isReferenceBinding() {
+ return true;
+ }
+ };
+ V2QRfcDestinationModel endpoint = new V2QRfcDestinationModel(CamelSapNamespace.V_2_0.uri(),
+ Constants.QRFC_DESTINATION);
+ endpoint.setDestinationName(DESTINATION_NAME);
+ endpoint.setQueueName(QUEUE_NAME);
+ endpoint.setRfcName(RFC_NAME);
+ endpoint.setTransacted(TRANSACTED);
+ return binding.setEndpointModel(endpoint);
+ }
+
+ @Override
+ protected void createModelAssertions(V2CamelSapBindingModel model) {
+ EndpointModel endpoint = model.getEndpointModel();
+ assertEquals(ENDPOINT_TYPE, endpoint.getName());
+ assertEquals(V2QRfcDestinationModel.class, endpoint.getClass());
+ V2QRfcDestinationModel rfcDest = V2QRfcDestinationModel.class.cast(endpoint);
+ assertEquals(DESTINATION_NAME, rfcDest.getDestinationName());
+ assertEquals(QUEUE_NAME, rfcDest.getQueueName());
+ assertEquals(RFC_NAME, rfcDest.getRfcName());
+ assertEquals(TRANSACTED, rfcDest.isTransacted());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapSRfcDestinationModelTest.java b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapSRfcDestinationModelTest.java
new file mode 100644
index 000000000..93e634b32
--- /dev/null
+++ b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapSRfcDestinationModelTest.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import static org.junit.Assert.assertEquals;
+
+import org.fusesource.camel.component.sap.SapTransactionalRfcDestinationEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelReferenceBindingModelTest;
+import org.switchyard.component.camel.sap.model.CamelSapNamespace;
+import org.switchyard.component.camel.sap.model.EndpointModel;
+
+/**
+ * Test for {@link V2CamelSapTRfcDestinationModel}.
+ */
+public class V2CamelSapSRfcDestinationModelTest extends V1BaseCamelReferenceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v2/switchyard-sap-trfc-destination-beans.xml";
+ private static final String ENDPOINT_TYPE = Constants.TRFC_DESTINATION;
+ private static final String DESTINATION_NAME = "nplHost";
+ private static final String RFC_NAME = "BAPI_FLTRIP_GETLIST";
+ private static final Boolean TRANSACTED = Boolean.TRUE;
+ private static final String CAMEL_URI = "sap-" + ENDPOINT_TYPE + ":" + DESTINATION_NAME + ":" + RFC_NAME
+ + "?transacted=" + TRANSACTED;
+
+ public V2CamelSapSRfcDestinationModelTest() {
+ super(SapTransactionalRfcDestinationEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V2CamelSapBindingModel createTestModel() {
+ V2CamelSapBindingModel binding =
+ new V2CamelSapBindingModel(CamelSapNamespace.V_2_0.uri()) {
+ @Override
+ public boolean isReferenceBinding() {
+ return true;
+ }
+ };
+ V2RfcDestinationModel endpoint = new V2RfcDestinationModel(CamelSapNamespace.V_2_0.uri(),
+ Constants.TRFC_DESTINATION);
+ endpoint.setDestinationName(DESTINATION_NAME);
+ endpoint.setRfcName(RFC_NAME);
+ endpoint.setTransacted(TRANSACTED);
+ return binding.setEndpointModel(endpoint);
+ }
+
+ @Override
+ protected void createModelAssertions(V2CamelSapBindingModel model) {
+ EndpointModel endpoint = model.getEndpointModel();
+ assertEquals(ENDPOINT_TYPE, endpoint.getName());
+ assertEquals(V2RfcDestinationModel.class, endpoint.getClass());
+ V2RfcDestinationModel rfcDest = V2RfcDestinationModel.class.cast(endpoint);
+ assertEquals(DESTINATION_NAME, rfcDest.getDestinationName());
+ assertEquals(RFC_NAME, rfcDest.getRfcName());
+ assertEquals(TRANSACTED, rfcDest.isTransacted());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapSRfcServerModelTest.java b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapSRfcServerModelTest.java
new file mode 100644
index 000000000..f82ed21e4
--- /dev/null
+++ b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapSRfcServerModelTest.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import static org.junit.Assert.assertEquals;
+
+import org.fusesource.camel.component.sap.SapSynchronousRfcServerEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.sap.model.CamelSapNamespace;
+import org.switchyard.component.camel.sap.model.EndpointModel;
+
+/**
+ * Test for {@link V2CamelSapSRfcServerModel}.
+ */
+public class V2CamelSapSRfcServerModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v2/switchyard-sap-srfc-server-beans.xml";
+ private static final String ENDPOINT_TYPE = Constants.SRFC_SERVER;
+ private static final String SERVER_NAME = "nplserver";
+ private static final String RFC_NAME = "BOOK_FLIGHT";
+ private static final String CAMEL_URI = "sap-" + ENDPOINT_TYPE + ":" + SERVER_NAME + ":" + RFC_NAME;
+
+ public V2CamelSapSRfcServerModelTest() {
+ super(SapSynchronousRfcServerEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V2CamelSapBindingModel createTestModel() {
+ V2RfcServerModel endpoint = new V2RfcServerModel(CamelSapNamespace.V_2_0.uri(), Constants.SRFC_SERVER);
+ endpoint.setServerName(SERVER_NAME);
+ endpoint.setRfcName(RFC_NAME);
+ return new V2CamelSapBindingModel(CamelSapNamespace.V_2_0.uri()).setEndpointModel(endpoint);
+ }
+
+ @Override
+ protected void createModelAssertions(V2CamelSapBindingModel model) {
+ EndpointModel endpoint = model.getEndpointModel();
+ assertEquals(ENDPOINT_TYPE, endpoint.getName());
+ assertEquals(V2RfcServerModel.class, endpoint.getClass());
+ V2RfcServerModel rfcServer = V2RfcServerModel.class.cast(endpoint);
+ assertEquals(SERVER_NAME, rfcServer.getServerName());
+ assertEquals(RFC_NAME, rfcServer.getRfcName());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapTRfcDestinationModelTest.java b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapTRfcDestinationModelTest.java
new file mode 100644
index 000000000..683a4bfc1
--- /dev/null
+++ b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapTRfcDestinationModelTest.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import static org.junit.Assert.assertEquals;
+
+import org.fusesource.camel.component.sap.SapSynchronousRfcDestinationEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelReferenceBindingModelTest;
+import org.switchyard.component.camel.sap.model.CamelSapNamespace;
+import org.switchyard.component.camel.sap.model.EndpointModel;
+
+/**
+ * Test for {@link V2CamelSapSRfcDestinationModel}.
+ */
+public class V2CamelSapTRfcDestinationModelTest extends V1BaseCamelReferenceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v2/switchyard-sap-srfc-destination-beans.xml";
+ private static final String ENDPOINT_TYPE = Constants.SRFC_DESTINATION;
+ private static final String DESTINATION_NAME = "nplHost";
+ private static final String RFC_NAME = "BAPI_FLTRIP_GETLIST";
+ private static final Boolean TRANSACTED = Boolean.TRUE;
+ private static final String CAMEL_URI = "sap-" + ENDPOINT_TYPE + ":" + DESTINATION_NAME + ":" + RFC_NAME
+ + "?transacted=" + TRANSACTED;
+
+ public V2CamelSapTRfcDestinationModelTest() {
+ super(SapSynchronousRfcDestinationEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V2CamelSapBindingModel createTestModel() {
+ V2CamelSapBindingModel binding =
+ new V2CamelSapBindingModel(CamelSapNamespace.V_2_0.uri()) {
+ @Override
+ public boolean isReferenceBinding() {
+ return true;
+ }
+ };
+ V2RfcDestinationModel endpoint = new V2RfcDestinationModel(CamelSapNamespace.V_2_0.uri(),
+ Constants.SRFC_DESTINATION);
+ endpoint.setDestinationName(DESTINATION_NAME);
+ endpoint.setRfcName(RFC_NAME);
+ endpoint.setTransacted(TRANSACTED);
+ return binding.setEndpointModel(endpoint);
+ }
+
+ @Override
+ protected void createModelAssertions(V2CamelSapBindingModel model) {
+ EndpointModel endpoint = model.getEndpointModel();
+ assertEquals(ENDPOINT_TYPE, endpoint.getName());
+ assertEquals(V2RfcDestinationModel.class, endpoint.getClass());
+ V2RfcDestinationModel rfcDest = V2RfcDestinationModel.class.cast(endpoint);
+ assertEquals(DESTINATION_NAME, rfcDest.getDestinationName());
+ assertEquals(RFC_NAME, rfcDest.getRfcName());
+ assertEquals(TRANSACTED, rfcDest.isTransacted());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapTRfcServerModelTest.java b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapTRfcServerModelTest.java
new file mode 100644
index 000000000..5f167fac2
--- /dev/null
+++ b/components/camel/camel-sap/src/test/java/org/switchyard/component/camel/sap/model/v2/V2CamelSapTRfcServerModelTest.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
+ *
+ * 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.
+ */
+package org.switchyard.component.camel.sap.model.v2;
+
+import static org.junit.Assert.assertEquals;
+
+import org.fusesource.camel.component.sap.SapTransactionalRfcServerEndpoint;
+import org.switchyard.component.camel.config.test.v1.V1BaseCamelServiceBindingModelTest;
+import org.switchyard.component.camel.sap.model.CamelSapNamespace;
+import org.switchyard.component.camel.sap.model.EndpointModel;
+
+/**
+ * Test for {@link V2CamelSapTRfcServerModel}.
+ */
+public class V2CamelSapTRfcServerModelTest extends V1BaseCamelServiceBindingModelTest {
+
+ private static final String CAMEL_XML = "/v2/switchyard-sap-trfc-server-beans.xml";
+ private static final String ENDPOINT_TYPE = Constants.TRFC_SERVER;
+ private static final String SERVER_NAME = "nplserver";
+ private static final String RFC_NAME = "BOOK_FLIGHT";
+ private static final String CAMEL_URI = "sap-" + ENDPOINT_TYPE + ":" + SERVER_NAME + ":" + RFC_NAME;
+
+ public V2CamelSapTRfcServerModelTest() {
+ super(SapTransactionalRfcServerEndpoint.class, CAMEL_XML);
+
+ setSkipCamelEndpointTesting(true);
+ }
+
+ @Override
+ protected V2CamelSapBindingModel createTestModel() {
+ V2RfcServerModel endpoint = new V2RfcServerModel(CamelSapNamespace.V_2_0.uri(), Constants.TRFC_SERVER);
+ endpoint.setServerName(SERVER_NAME);
+ endpoint.setRfcName(RFC_NAME);
+ return new V2CamelSapBindingModel(CamelSapNamespace.V_2_0.uri()).setEndpointModel(endpoint);
+ }
+
+ @Override
+ protected void createModelAssertions(V2CamelSapBindingModel model) {
+ EndpointModel endpoint = model.getEndpointModel();
+ assertEquals(ENDPOINT_TYPE, endpoint.getName());
+ assertEquals(V2RfcServerModel.class, endpoint.getClass());
+ V2RfcServerModel rfcServer = V2RfcServerModel.class.cast(endpoint);
+ assertEquals(SERVER_NAME, rfcServer.getServerName());
+ assertEquals(RFC_NAME, rfcServer.getRfcName());
+ }
+
+ @Override
+ protected String createEndpointUri() {
+ return CAMEL_URI;
+ }
+
+}
diff --git a/components/camel/camel-sap/src/test/resources/v2/switchyard-sap-idoc-destination-beans.xml b/components/camel/camel-sap/src/test/resources/v2/switchyard-sap-idoc-destination-beans.xml
new file mode 100644
index 000000000..e73be1064
--- /dev/null
+++ b/components/camel/camel-sap/src/test/resources/v2/switchyard-sap-idoc-destination-beans.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+