summaryrefslogtreecommitdiffstats
path: root/tags/java/sca/1.0.1/samples/quote-xquery
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /tags/java/sca/1.0.1/samples/quote-xquery
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tags/java/sca/1.0.1/samples/quote-xquery')
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/DISCLAIMER8
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/LICENSE205
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/NOTICE6
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/README347
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/build.xml120
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/pom.xml180
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java30
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java28
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java27
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java27
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java28
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java27
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java28
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java27
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java26
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java38
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java107
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java29
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java34
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java67
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java145
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java39
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq61
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq69
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq74
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd39
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd49
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd40
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl137
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/xqueryquotews.composite52
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite111
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java192
-rw-r--r--tags/java/sca/1.0.1/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java50
33 files changed, 2447 insertions, 0 deletions
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/DISCLAIMER b/tags/java/sca/1.0.1/samples/quote-xquery/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/DISCLAIMER
@@ -0,0 +1,8 @@
+Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/LICENSE b/tags/java/sca/1.0.1/samples/quote-xquery/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/NOTICE b/tags/java/sca/1.0.1/samples/quote-xquery/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/README b/tags/java/sca/1.0.1/samples/quote-xquery/README
new file mode 100644
index 0000000000..e072605908
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/README
@@ -0,0 +1,347 @@
+Quote Xquery Sample
+===================
+
+ This sample covers the most important integration scenarios for the xquery
+ implementation type and its corresponding saxon data bindings.
+
+If you just want to run it to see what happens open two command prompts (one for the server
+and the other for the client), navigate to this sample directory and do:
+
+Command Prompt 1:
+---------------------------------------
+
+ant run-server
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-quote-xquery.jar xquery.quote.XQueryQuoteServer
+
+and on Linux do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-quote-xquery.jar xquery.quote.XQueryQuoteServer
+
+
+Output
+------
+Buildfile: build.xml
+
+run-server:
+ [java] Nov 1, 2007 11:29:31 PM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping
+ [java] INFO: Added Servlet mapping: http://localhost:8085/QuoteJoinService
+ [java] Nov 1, 2007 11:29:31 PM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping
+ [java] INFO: Added Servlet mapping: http://localhost:8085/AvailQuoteProviderService
+ [java] XQuery Quote server is started (press enter to shutdown).
+
+
+Leave the server running and open another command prompt and navigate into this sample directory
+
+
+
+
+Command Prompt 2:
+----------------------------------------
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-quote-xquery.jar xquery.quote.XQueryQuoteClient
+
+and on Linux do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-quote-xquery.jar xquery.quote.XQueryQuoteClient
+
+
+Output
+----------
+Buildfile: build.xml
+
+run:
+ [java] Input quote for the price list:
+ [java] <?xml version="1.0" encoding="ASCII"?>
+ [java] <priceQuote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pri="http://www.example.org/price" xsi:type="pri:PriceQuote">
+ [java] <customerName>Acme Inc</customerName>
+ [java] <shipAddress street="12 Springs Rd" city="Morris Plains" state="nj" zip="07960"/>
+ [java] <priceRequests>
+ [java] <priceRequest>
+ [java] <widgetId>12</widgetId>
+ [java] <price>1.0</price>
+ [java] </priceRequest>
+ [java] <priceRequest>
+ [java] <widgetId>134</widgetId>
+ [java] <price>34.1</price>
+ [java] </priceRequest>
+ [java] <priceRequest>
+ [java] <widgetId>211</widgetId>
+ [java] <price>10.0</price>
+ [java] </priceRequest>
+ [java] </priceRequests>
+ [java] </priceQuote>
+ [java]
+ [java] Input quote for the availability:
+ [java] <?xml version="1.0" encoding="ASCII"?>
+ [java] <availQuote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ava="http://www.example.org/avail" xsi:type="ava:AvailQuote">
+ [java] <availRequest>
+ [java] <widgetId>12</widgetId>
+ [java] <requestedQuantity>10</requestedQuantity>
+ [java] <quantityAvail>true</quantityAvail>
+ [java] <shipDate>2003-03-22</shipDate>
+ [java] </availRequest>
+ [java] <availRequest>
+ [java] <widgetId>134</widgetId>
+ [java] <requestedQuantity>345</requestedQuantity>
+ [java] <quantityAvail>false</quantityAvail>
+ [java] <shipDate>BackOrder</shipDate>
+ [java] </availRequest>
+ [java] <availRequest>
+ [java] <widgetId>211</widgetId>
+ [java] <requestedQuantity>100</requestedQuantity>
+ [java] <quantityAvail>true</quantityAvail>
+ [java] <shipDate>2003-04-21</shipDate>
+ [java] </availRequest>
+ [java] </availQuote>
+ [java]
+ [java]
+ [java] Output quote from local join:
+ [java] <?xml version="1.0" encoding="ASCII"?>
+ [java] <quote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:quo="http://www.example.org/quote" xsi:type="quo:Quote">
+ [java] <name>Acme Inc</name>
+ [java] <address>12 Springs Rd,Morris Plains,NJ,07960</address>
+ [java] <quoteResponse>
+ [java] <widgetId>12</widgetId>
+ [java] <unitPrice>1.0</unitPrice>
+ [java] <requestedQuantity>10</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-03-22</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>11.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>134</widgetId>
+ [java] <unitPrice>34.1</unitPrice>
+ [java] <requestedQuantity>345</requestedQuantity>
+ [java] <fillOrder>false</fillOrder>
+ [java] <shipDate>BackOrder</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>0.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>211</widgetId>
+ [java] <unitPrice>10.0</unitPrice>
+ [java] <requestedQuantity>100</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-04-21</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>1100.0</totalCost>
+ [java] </quoteResponse>
+ [java] </quote>
+ [java]
+ [java]
+ [java] Output quote from local join (second invokation):
+ [java] <?xml version="1.0" encoding="ASCII"?>
+ [java] <quote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:quo="http://www.example.org/quote" xsi:type="quo:Quote">
+ [java] <name>Acme Inc</name>
+ [java] <address>12 Springs Rd,Morris Plains,NJ,07960</address>
+ [java] <quoteResponse>
+ [java] <widgetId>12</widgetId>
+ [java] <unitPrice>1.0</unitPrice>
+ [java] <requestedQuantity>10</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-03-22</shipDate>
+ [java] <taxRate>0.2</taxRate>
+ [java] <totalCost>12.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>134</widgetId>
+ [java] <unitPrice>34.1</unitPrice>
+ [java] <requestedQuantity>345</requestedQuantity>
+ [java] <fillOrder>false</fillOrder>
+ [java] <shipDate>BackOrder</shipDate>
+ [java] <taxRate>0.2</taxRate>
+ [java] <totalCost>0.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>211</widgetId>
+ [java] <unitPrice>10.0</unitPrice>
+ [java] <requestedQuantity>100</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-04-21</shipDate>
+ [java] <taxRate>0.2</taxRate>
+ [java] <totalCost>1200.0</totalCost>
+ [java] </quoteResponse>
+ [java] </quote>
+ [java]
+ [java]
+ [java] Output quote from web service join:
+ [java] <?xml version="1.0" encoding="ASCII"?>
+ [java] <quote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:quo="http://www.example.org/quote" xsi:type="quo:Quote">
+ [java] <name>Acme Inc</name>
+ [java] <address>12 Springs Rd,Morris Plains,NJ,07960</address>
+ [java] <quoteResponse>
+ [java] <widgetId>12</widgetId>
+ [java] <unitPrice>1.0</unitPrice>
+ [java] <requestedQuantity>10</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-03-22</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>11.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>134</widgetId>
+ [java] <unitPrice>34.1</unitPrice>
+ [java] <requestedQuantity>345</requestedQuantity>
+ [java] <fillOrder>false</fillOrder>
+ [java] <shipDate>BackOrder</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>0.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>211</widgetId>
+ [java] <unitPrice>10.0</unitPrice>
+ [java] <requestedQuantity>100</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-04-21</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>1100.0</totalCost>
+ [java] </quoteResponse>
+ [java] </quote>
+ [java]
+ [java]
+ [java] Output quote from properties join:
+ [java] <?xml version="1.0" encoding="ASCII"?>
+ [java] <quote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:quo="http://www.example.org/quote" xsi:type="quo:Quote">
+ [java] <name>Acme Inc</name>
+ [java] <address>12 Springs Rd,Morris Plains,NJ,07960</address>
+ [java] <quoteResponse>
+ [java] <widgetId>12</widgetId>
+ [java] <unitPrice>1.0</unitPrice>
+ [java] <requestedQuantity>10</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-03-22</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>11.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>134</widgetId>
+ [java] <unitPrice>34.1</unitPrice>
+ [java] <requestedQuantity>345</requestedQuantity>
+ [java] <fillOrder>false</fillOrder>
+ [java] <shipDate>BackOrder</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>0.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>211</widgetId>
+ [java] <unitPrice>10.0</unitPrice>
+ [java] <requestedQuantity>100</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-04-21</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>1100.0</totalCost>
+ [java] </quoteResponse>
+ [java] </quote>
+ [java]
+ [java]
+ [java] Output quote from external references join:
+ [java] <?xml version="1.0" encoding="ASCII"?>
+ [java] <quote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:quo="http://www.example.org/quote" xsi:type="quo:Quote">
+ [java] <name>Acme Inc</name>
+ [java] <address>12 Springs Rd,Morris Plains,NJ,07960</address>
+ [java] <quoteResponse>
+ [java] <widgetId>12</widgetId>
+ [java] <unitPrice>1.0</unitPrice>
+ [java] <requestedQuantity>10</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-03-22</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>11.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>134</widgetId>
+ [java] <unitPrice>34.1</unitPrice>
+ [java] <requestedQuantity>345</requestedQuantity>
+ [java] <fillOrder>false</fillOrder>
+ [java] <shipDate>BackOrder</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>0.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>211</widgetId>
+ [java] <unitPrice>10.0</unitPrice>
+ [java] <requestedQuantity>100</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-04-21</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>1100.0</totalCost>
+ [java] </quoteResponse>
+ [java] </quote>
+ [java]
+
+BUILD SUCCESSFUL
+Total time: 16 seconds
+
+
+
+Sample Overview
+---------------
+
+ 1. There is a central component for invoking the different
+ scenarios: QuoteJoinLocalComponent
+ 2. It provides the following cases:
+ - invoke XQuery component in the current assembly, by providing all needed
+ information as input parameters
+ - invoke XQuery component in external assembly, which is exposed as a web
+ service
+ - invoke XQuery component in the current assembly, which retrieves the needed
+ information from the component properties
+ - invoke XQuery component in the current assembly, which retrieves the needed
+ information from its references to other components:
+ - one of the components is in the current assembly
+ - the other component is in anther assembly and it is exposed (and accessed)
+ as web service
+
+ 3. All of the XQuery components have reference to a component for calculation of the
+ total price
+ 4. SDO is used for data interchange
+
+src/main/resources
+ wsdl
+ AvailQuote.xsd
+ PriceQuote.xsd
+ Quote.xsd
+ quotejoin.wsdl
+ META-INF
+ sca
+ quote_join_external_references.xq --- the external references xquery script
+ quote_join_properties.xq --- the property-based join xquery script
+ quote_join.xq --- the join xquery script
+ xqueryquotews.composite --- composite file for the client side
+ xqueryquotewsclient.composite --- composite file for the service side
+
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+cd quote-xquery
+ant compile
+ant run-server
+
+you should see:
+Buildfile: build.xml
+
+run:
+
+
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd quote-xquery
+mvn
+
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/build.xml b/tags/java/sca/1.0.1/samples/quote-xquery/build.xml
new file mode 100644
index 0000000000..c54ad91b63
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/build.xml
@@ -0,0 +1,120 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project name="sample-quote-xquery" default="compile">
+ <property name="test.class" value="xquery.quote.XQueryQuoteClient" />
+ <property name="test.server.class" value="xquery.quote.XQueryQuoteServer" />
+ <property name="test.jar" value="sample-quote-xquery.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes" />
+ </target>
+
+ <property name="tuscany.sca.manifest.location" value="../../lib/tuscany-sca-manifest.jar" />
+
+ <path id="project.classpath">
+ <pathelement path="target/classes" />
+ <pathelement path="target/sdo-source" />
+ <pathelement location="${tuscany.sca.manifest.location}" />
+ </path>
+
+ <target name="generate-sdo" depends="init">
+ <java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator" fork="true">
+ <arg value="-targetDirectory" />
+ <arg value="target/sdo-source" />
+ <arg value="-noNotification" />
+ <!-- Make sure the -noUnsettable is not used, otherwise, the SDO cannot be
+ properly transformed to Node as some properties are treated as unset -->
+ <arg value="src/main/resources/wsdl/Quote.xsd" />
+
+ <classpath refid="project.classpath" />
+ </java>
+ <java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator" fork="true">
+ <arg value="-targetDirectory" />
+ <arg value="target/sdo-source" />
+ <arg value="-noNotification" />
+ <!-- Make sure the -noUnsettable is not used, otherwise, the SDO cannot be
+ properly transformed to Node as some properties are treated as unset -->
+ <arg value="src/main/resources/wsdl/AvailQuote.xsd" />
+
+ <classpath refid="project.classpath" />
+ </java>
+ <java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator" fork="true">
+ <arg value="-targetDirectory" />
+ <arg value="target/sdo-source" />
+ <arg value="-noNotification" />
+ <!-- Make sure the -noUnsettable is not used, otherwise, the SDO cannot be
+ properly transformed to Node as some properties are treated as unset -->
+ <arg value="src/main/resources/wsdl/PriceQuote.xsd" />
+
+ <classpath refid="project.classpath" />
+ </java>
+
+ </target>
+
+
+ <target name="compile" depends="init, generate-sdo">
+ <javac destdir="target/classes" debug="on" source="1.5" target="1.5">
+ <src path="target/sdo-source"/>
+ <src path="src/main/java"/>
+ <classpath refid="project.classpath" />
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources" />
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}" fork="true">
+ <classpath>
+ <pathelement path="target/classes" />
+ </classpath>
+ <classpath refid="project.classpath" />
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}" fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}" />
+ </classpath>
+ <classpath refid="project.classpath" />
+ </java>
+ </target>
+
+ <target name="run-server">
+ <java classname="${test.server.class}" fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}" />
+ </classpath>
+ <classpath refid="project.classpath" />
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target" />
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/pom.xml b/tags/java/sca/1.0.1/samples/quote-xquery/pom.xml
new file mode 100644
index 0000000000..1fe795a6c3
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/pom.xml
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.0.1-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-quote-xquery</artifactId>
+ <name>Apache Tuscany SCA XQuery Quote Implementation Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.0.1-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.0.1-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-xquery</artifactId>
+ <version>1.0.1-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.0.1-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-lib</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon</artifactId>
+ <version>8.7</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.0.1-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.0.1-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating</version>
+ <executions>
+ <!--
+ <execution>
+ <id>generate-quotejoin-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/quotejoin.wsdl</schemaFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ -->
+ <execution>
+ <id>generate-quote-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/Quote.xsd</schemaFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>generate-avail-quote-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/AvailQuote.xsd</schemaFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>generate-price-quote-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/PriceQuote.xsd</schemaFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java
new file mode 100644
index 0000000000..8a42136b5d
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.example.avail.AvailQuote;
+import org.osoa.sca.annotations.Service;
+
+@Service(AvailQuoteProviderService.class)
+public class AvailQuoteProviderImpl implements AvailQuoteProviderService {
+
+ public AvailQuote provideAvailQuote(String dummyString) {
+ return QuoteDataUtil.buildAvailQuoteData();
+ }
+}
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java
new file mode 100644
index 0000000000..41d78683cc
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java
@@ -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.
+ */
+package xquery.quote;
+
+import net.sf.saxon.om.NodeInfo;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface AvailQuoteProviderNodeInfo {
+ NodeInfo provideAvailQuote(String dummyString);
+}
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java
new file mode 100644
index 0000000000..f744a59744
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.example.avail.AvailQuote;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface AvailQuoteProviderService {
+ AvailQuote provideAvailQuote(String dummyString);
+}
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java
new file mode 100644
index 0000000000..374c0825e9
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.example.quote.Quote;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface ExternalReferencesQuoteJoin {
+ public Quote joinPriceAndAvailQuotes(float taxRate);
+}
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java
new file mode 100644
index 0000000000..fbe38b8269
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java
@@ -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.
+ */
+package xquery.quote;
+
+import org.example.price.PriceQuote;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface PriceQuoteProvider {
+
+ public PriceQuote providePriceQuote();
+}
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java
new file mode 100644
index 0000000000..d2d175430b
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.example.price.PriceQuote;
+
+public class PriceQuoteProviderImpl implements PriceQuoteProvider {
+ public PriceQuote providePriceQuote() {
+ return QuoteDataUtil.buildPriceQuoteData();
+ }
+}
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java
new file mode 100644
index 0000000000..06c3945a6e
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java
@@ -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.
+ */
+package xquery.quote;
+
+import net.sf.saxon.om.NodeInfo;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface PriceQuoteProviderNodeInfo {
+ public NodeInfo providePriceQuote();
+}
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java
new file mode 100644
index 0000000000..4ab64dd558
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.example.quote.Quote;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface PropertiesQuoteJoin {
+ public Quote joinPriceAndAvailQuotes();
+}
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java
new file mode 100644
index 0000000000..85508eaa46
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface QuoteCalculator {
+ public float calculateTotalPrice(float taxRate, int quantity, float price, boolean fillOrder);
+}
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java
new file mode 100644
index 0000000000..26331381a8
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+public class QuoteCalculatorImpl implements QuoteCalculator {
+
+ public float calculateTotalPrice(float taxRate, int quantity, float price, boolean fillOrder) {
+ float totalTax, costNoTax, totalCost;
+ if (fillOrder) {
+ // Calculate the total tax
+ totalTax = taxRate * quantity * price;
+ // Calculate the total cost without tax
+ costNoTax = quantity * price;
+ // Add the tax and the cost to get the total cost
+ totalCost = totalTax + costNoTax;
+ } else {
+ totalCost = 0;
+ }
+ return totalCost;
+ }
+
+}
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java
new file mode 100644
index 0000000000..6144dcc17f
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import java.io.IOException;
+import java.math.BigInteger;
+
+
+import org.example.avail.AvailFactory;
+import org.example.avail.AvailQuote;
+import org.example.avail.AvailRequest;
+import org.example.price.PriceFactory;
+import org.example.price.PriceQuote;
+import org.example.price.PriceRequest;
+import org.example.price.PriceRequests;
+import org.example.price.ShipAddress;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.XMLHelper;
+
+public class QuoteDataUtil {
+
+ public static AvailQuote buildAvailQuoteData() {
+ AvailQuote availQuote = AvailFactory.INSTANCE.createAvailQuote();
+ AvailRequest availRequest = AvailFactory.INSTANCE.createAvailRequest();
+ availRequest.setWidgetId(BigInteger.valueOf(12));
+ availRequest.setRequestedQuantity(10);
+ availRequest.setQuantityAvail(true);
+ availRequest.setShipDate("2003-03-22");
+ availQuote.getAvailRequest().add(availRequest);
+
+ availRequest = AvailFactory.INSTANCE.createAvailRequest();
+ availRequest.setWidgetId(BigInteger.valueOf(134));
+ availRequest.setRequestedQuantity(345);
+ availRequest.setQuantityAvail(false);
+ availRequest.setShipDate("BackOrder");
+ availQuote.getAvailRequest().add(availRequest);
+
+ availRequest = AvailFactory.INSTANCE.createAvailRequest();
+ availRequest.setWidgetId(BigInteger.valueOf(211));
+ availRequest.setRequestedQuantity(100);
+ availRequest.setQuantityAvail(true);
+ availRequest.setShipDate("2003-04-21");
+ availQuote.getAvailRequest().add(availRequest);
+
+ return availQuote;
+ }
+
+ public static PriceQuote buildPriceQuoteData() {
+ PriceQuote priceQuote = PriceFactory.INSTANCE.createPriceQuote();
+ priceQuote.setCustomerName("Acme Inc");
+
+ ShipAddress shipAddress = PriceFactory.INSTANCE.createShipAddress();
+ shipAddress.setStreet("12 Springs Rd");
+ shipAddress.setCity("Morris Plains");
+ shipAddress.setState("nj");
+ shipAddress.setZip("07960");
+ priceQuote.setShipAddress(shipAddress);
+
+ PriceRequests priceRequests = PriceFactory.INSTANCE.createPriceRequests();
+ PriceRequest priceRequest = PriceFactory.INSTANCE.createPriceRequest();
+ priceRequest.setWidgetId(BigInteger.valueOf(12));
+ priceRequest.setPrice(1.00f);
+ priceRequests.getPriceRequest().add(priceRequest);
+
+ priceRequest = PriceFactory.INSTANCE.createPriceRequest();
+ priceRequest.setWidgetId(BigInteger.valueOf(134));
+ priceRequest.setPrice(34.10f);
+ priceRequests.getPriceRequest().add(priceRequest);
+
+ priceRequest = PriceFactory.INSTANCE.createPriceRequest();
+ priceRequest.setWidgetId(BigInteger.valueOf(211));
+ priceRequest.setPrice(10.00f);
+ priceRequests.getPriceRequest().add(priceRequest);
+
+ priceQuote.setPriceRequests(priceRequests);
+
+ return priceQuote;
+ }
+
+ public static void serializeToSystemOut(DataObject object, String name) {
+ XMLHelper helper = XMLHelper.INSTANCE;
+
+ try {
+ helper.save(object, null, name, System.out);
+ System.out.println();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java
new file mode 100644
index 0000000000..43b2d41a5d
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.example.avail.AvailQuote;
+import org.example.price.PriceQuote;
+import org.example.quote.Quote;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface QuoteJoin {
+ public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate);
+}
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java
new file mode 100644
index 0000000000..cfd201f883
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.example.avail.AvailQuote;
+import org.example.price.PriceQuote;
+import org.example.quote.Quote;
+
+public interface QuoteJoinLocal {
+ public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate);
+
+ public Quote joinPriceAndAvailQuotesWs(PriceQuote priceQuote, AvailQuote availQuote, float taxRate);
+
+ public Quote joinPriceAndAvailQuotes();
+
+ public Quote joinPriceAndAvailQuotes(float taxRate);
+
+}
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java
new file mode 100644
index 0000000000..20fe73fd92
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.example.avail.AvailQuote;
+import org.example.price.PriceQuote;
+import org.example.quote.Quote;
+import org.osoa.sca.annotations.Reference;
+
+public class QuoteJoinLocalImpl implements QuoteJoinLocal {
+ private QuoteJoin quoteJoin;
+ private QuoteJoin quoteJoinWs;
+ private PropertiesQuoteJoin propertiesQuoteJoin;
+ private ExternalReferencesQuoteJoin externalServicesQuoteJoin;
+
+ @Reference
+ public void setQuoteJoin(QuoteJoin quoteJoin) {
+ this.quoteJoin = quoteJoin;
+ }
+
+ @Reference
+ public void setQuoteJoinWs(QuoteJoin quoteJoinWs) {
+ this.quoteJoinWs = quoteJoinWs;
+ }
+
+ @Reference
+ public void setPropertiesQuoteJoin(PropertiesQuoteJoin propertiesQuoteJoin) {
+ this.propertiesQuoteJoin = propertiesQuoteJoin;
+ }
+
+ @Reference
+ public void setExternalServicesQuoteJoin(ExternalReferencesQuoteJoin externalServicesQuoteJoin) {
+ this.externalServicesQuoteJoin = externalServicesQuoteJoin;
+ }
+
+ public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate) {
+ return quoteJoin.joinPriceAndAvailQuotes(priceQuote, availQuote, taxRate);
+ }
+
+ public Quote joinPriceAndAvailQuotesWs(PriceQuote priceQuote, AvailQuote availQuote, float taxRate) {
+ return quoteJoinWs.joinPriceAndAvailQuotes(priceQuote, availQuote, taxRate);
+ }
+
+ public Quote joinPriceAndAvailQuotes(float taxRate) {
+ return externalServicesQuoteJoin.joinPriceAndAvailQuotes(taxRate);
+ }
+
+ public Quote joinPriceAndAvailQuotes() {
+ return propertiesQuoteJoin.joinPriceAndAvailQuotes();
+ }
+}
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java
new file mode 100644
index 0000000000..98dd96ffaf
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.example.avail.AvailQuote;
+import org.example.price.PriceQuote;
+import org.example.quote.Quote;
+
+import commonj.sdo.DataObject;
+
+/**
+ * Integration test for the XQuery implementation type
+ * @version $Rev$ $Date$
+ * This test covers the most important integration scenarios for the xquery
+ * implementation type and its corresponding saxon data bindings:
+ *
+ * 1. There is a central component for invoking the different
+ * scenarios: QuoteJoinLocalComponent
+ * 2. It provides the following tests:
+ * - invoke XQuery component in the current assembly, by providing all needed
+ * information as input parameters
+ * - invoke XQuery component in external assembly, which is exposed as a web
+ * service
+ * - invoke XQuery component in the current assembly, which retrieves the needed
+ * information from the component properties
+ * - invoke XQuery component in the current assembly, which retrieves the needed
+ * information from its references to other components:
+ * - one of the components is in the current assembly
+ * - the other component is in anther assembly and it is exposed (and accessed)
+ * as web service
+ *
+ * 3. All of the XQuery components have reference to a component for calculation of the
+ * total price
+ * 4. SDO is used for data interchange
+ */
+public class XQueryQuoteClient {
+
+ public static boolean SHOW_DEBUG_MSG = false;
+
+ private SCADomain scaDomain;
+
+ private QuoteJoinLocal quoteJoinLocal;
+
+ public void startClient() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("xqueryquotewsclient.composite");
+ quoteJoinLocal = scaDomain.getService(QuoteJoinLocal.class, "QuoteJoinLocalComponent");
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ public void testQuoteJoin() {
+ AvailQuote availQuote = QuoteDataUtil.buildAvailQuoteData();
+ PriceQuote priceQuote = QuoteDataUtil.buildPriceQuoteData();
+
+ if (SHOW_DEBUG_MSG) {
+ System.out.println("Input quote for the price list:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)priceQuote, "priceQuote");
+ System.out.println();
+ System.out.println("Input quote for the availability:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)availQuote, "availQuote");
+ System.out.println();
+ }
+
+ Quote quote = quoteJoinLocal.joinPriceAndAvailQuotes(priceQuote, availQuote, 0.1f);
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from local join:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f);
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotes(priceQuote, availQuote, 0.2f);
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from local join (second invokation):");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.2f);
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotesWs(priceQuote, availQuote, 0.1f);
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from web service join:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f);
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotes();
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from properties join:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f);
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotes(0.1f);
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from external references join:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f);
+ }
+
+ public void stopClient() throws Exception {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ SHOW_DEBUG_MSG = true;
+ XQueryQuoteClient client = new XQueryQuoteClient();
+ client.startClient();
+ try {
+ client.testQuoteJoin();
+ } finally {
+ client.stopClient();
+ }
+ }
+}
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java
new file mode 100644
index 0000000000..d02190ab94
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class XQueryQuoteServer {
+
+ public static void main(String[] args) {
+ SCADomain scaDomain = SCADomain.newInstance("xqueryquotews.composite");
+ try {
+ System.out.println("XQuery Quote server is started (press enter to shutdown).");
+ System.in.read();
+ System.out.println("XQuery Quote server is stopping...");
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ scaDomain.close();
+ System.out.println("XQuery Quote server is now stopped.");
+ }
+}
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq
new file mode 100644
index 0000000000..d4dfde3c01
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq
@@ -0,0 +1,61 @@
+(:
+ * 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.
+:)
+
+declare namespace quoteJoin="scaservice:java/xquery.quote.QuoteJoin";
+
+declare namespace quoteCalculator="scareference:java/xquery.quote.QuoteCalculator";
+
+declare namespace quo="http://www.example.org/quote";
+
+declare variable $quoteCalculator external;
+
+declare function quoteJoin:joinPriceAndAvailQuotes($priceQuoteDoc, $availQuoteDoc, $taxRate) {
+<quo:quote>
+ <quo:name>{ data($priceQuoteDoc/priceQuote/customerName) }</quo:name>
+ <quo:address>{ concat($priceQuoteDoc/priceQuote/shipAddress/@street , ",", $priceQuoteDoc/priceQuote/shipAddress/@city ,",", fn:upper-case($priceQuoteDoc/priceQuote/shipAddress/@state) , ",", $priceQuoteDoc/priceQuote/shipAddress/@zip) }</quo:address>
+ {
+ for $priceRequest in $priceQuoteDoc/priceQuote/priceRequests/priceRequest,
+ $availRequest in $availQuoteDoc/availQuote/availRequest
+ where data($priceRequest/widgetId) = data($availRequest/widgetId)
+ return
+ <quo:quoteResponse>
+ <quo:widgetId>{ data($priceRequest/widgetId) }</quo:widgetId>
+ <quo:unitPrice>{ data($priceRequest/price) }</quo:unitPrice>
+ <quo:requestedQuantity>{ data($availRequest/requestedQuantity) }</quo:requestedQuantity>
+ <quo:fillOrder>{ data($availRequest/quantityAvail) }</quo:fillOrder>
+ {
+ for $shipDate in $availRequest/shipDate
+ return
+ <quo:shipDate>{ data($shipDate) }</quo:shipDate>
+ }
+ <quo:taxRate>{ $taxRate }</quo:taxRate>
+ <quo:totalCost>{ quoteCalculator:calculateTotalPrice(
+ $quoteCalculator,
+
+ $taxRate,
+
+ $availRequest/requestedQuantity,
+
+ $priceRequest/price,
+
+ $availRequest/quantityAvail) }</quo:totalCost>
+ </quo:quoteResponse>
+ }
+ </quo:quote>
+};
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq
new file mode 100644
index 0000000000..cc50da164a
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq
@@ -0,0 +1,69 @@
+(:
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+:)
+declare namespace quoteJoin="scaservice:java/xquery.quote.ExternalReferencesQuoteJoin";
+
+declare namespace quoteCalculator="scareference:java/xquery.quote.QuoteCalculator";
+
+declare namespace priceQuoteProvider="scareference:java/xquery.quote.PriceQuoteProviderNodeInfo";
+declare namespace availQuoteProvider="scareference:java/xquery.quote.AvailQuoteProviderNodeInfo";
+
+declare namespace quo="http://www.example.org/quote";
+
+declare variable $quoteCalculator external;
+
+declare variable $priceQuoteProvider external;
+declare variable $availQuoteProvider external;
+
+declare function quoteJoin:joinPriceAndAvailQuotes($taxRate) {
+let $priceQuoteDoc := priceQuoteProvider:providePriceQuote($priceQuoteProvider)
+let $availQuoteDoc := availQuoteProvider:provideAvailQuote($availQuoteProvider, 'dummy')
+return
+<quo:quote>
+ <quo:name>{ data($priceQuoteDoc/priceQuote/customerName) }</quo:name>
+ <quo:address>{ concat($priceQuoteDoc/priceQuote/shipAddress/@street , ",", $priceQuoteDoc/priceQuote/shipAddress/@city ,",", fn:upper-case($priceQuoteDoc/priceQuote/shipAddress/@state) , ",", $priceQuoteDoc/priceQuote/shipAddress/@zip) }</quo:address>
+ {
+ for $priceRequest in $priceQuoteDoc/priceQuote/priceRequests/priceRequest,
+ $availRequest in $availQuoteDoc/availQuote/availRequest
+ where data($priceRequest/widgetId) = data($availRequest/widgetId)
+ return
+ <quo:quoteResponse>
+ <quo:widgetId>{ data($priceRequest/widgetId) }</quo:widgetId>
+ <quo:unitPrice>{ data($priceRequest/price) }</quo:unitPrice>
+ <quo:requestedQuantity>{ data($availRequest/requestedQuantity) }</quo:requestedQuantity>
+ <quo:fillOrder>{ data($availRequest/quantityAvail) }</quo:fillOrder>
+ {
+ for $shipDate in $availRequest/shipDate
+ return
+ <quo:shipDate>{ data($shipDate) }</quo:shipDate>
+ }
+ <quo:taxRate>{ $taxRate }</quo:taxRate>
+ <quo:totalCost>{ quoteCalculator:calculateTotalPrice(
+ $quoteCalculator,
+
+ $taxRate,
+
+ $availRequest/requestedQuantity,
+
+ $priceRequest/price,
+
+ $availRequest/quantityAvail) }</quo:totalCost>
+ </quo:quoteResponse>
+ }
+ </quo:quote>
+};
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq
new file mode 100644
index 0000000000..cf41ab528d
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq
@@ -0,0 +1,74 @@
+(:
+ * 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.
+:)
+
+declare namespace quoteJoin="scaservice:java/xquery.quote.PropertiesQuoteJoin";
+
+declare namespace quoteCalculator="scareference:java/xquery.quote.QuoteCalculator";
+
+declare namespace priceQuoteDoc="scaproperty:xml/http://www.example.org/price:priceQuote";
+declare namespace availQuoteDoc="scaproperty:xml/http://www.example.org/avail:availQuote";
+declare namespace taxRate="scaproperty:java/java.lang.Float";
+
+declare namespace pri="http://www.example.org/price";
+declare namespace ava="http://www.example.org/avail";
+declare namespace quo="http://www.example.org/quote";
+
+declare variable $quoteCalculator external;
+
+declare variable $priceQuoteDoc external;
+declare variable $availQuoteDoc external;
+declare variable $taxRate external;
+
+declare function quoteJoin:joinPriceAndAvailQuotes() {
+<quo:quote>
+ <quo:name>{ data($priceQuoteDoc/pri:priceQuote/customerName) }</quo:name>
+ <quo:address>{ concat($priceQuoteDoc/pri:priceQuote/shipAddress/@street , ",",
+ $priceQuoteDoc/pri:priceQuote/shipAddress/@city ,",",
+ fn:upper-case($priceQuoteDoc/pri:priceQuote/shipAddress/@state) , ",",
+ $priceQuoteDoc/pri:priceQuote/shipAddress/@zip) }</quo:address>
+ {
+ for $priceRequest in $priceQuoteDoc/pri:priceQuote/priceRequests/priceRequest,
+ $availRequest in $availQuoteDoc/ava:availQuote/availRequest
+ where data($priceRequest/widgetId) = data($availRequest/widgetId)
+ return
+ <quo:quoteResponse>
+ <quo:widgetId>{ data($priceRequest/widgetId) }</quo:widgetId>
+ <quo:unitPrice>{ data($priceRequest/price) }</quo:unitPrice>
+ <quo:requestedQuantity>{ data($availRequest/requestedQuantity) }</quo:requestedQuantity>
+ <quo:fillOrder>{ data($availRequest/quantityAvail) }</quo:fillOrder>
+ {
+ for $shipDate in $availRequest/shipDate
+ return
+ <quo:shipDate>{ data($shipDate) }</quo:shipDate>
+ }
+ <quo:taxRate>{ $taxRate }</quo:taxRate>
+ <quo:totalCost>{ quoteCalculator:calculateTotalPrice(
+ $quoteCalculator,
+
+ $taxRate,
+
+ $availRequest/requestedQuantity,
+
+ $priceRequest/price,
+
+ $availRequest/quantityAvail) }</quo:totalCost>
+ </quo:quoteResponse>
+ }
+ </quo:quote>
+};
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd
new file mode 100644
index 0000000000..e7f3e67068
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<xsd:schema targetNamespace="http://www.example.org/avail" xmlns:ava="http://www.example.org/avail" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified">
+ <xsd:element name="availQuote" type="ava:AvailQuote"/>
+ <xsd:complexType name="AvailRequest">
+ <xsd:sequence>
+ <xsd:element name="widgetId" type="xsd:integer"/>
+ <xsd:element name="requestedQuantity" type="xsd:int"/>
+ <xsd:element name="quantityAvail" type="xsd:boolean"/>
+ <xsd:element name="shipDate" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AvailQuote">
+ <xsd:sequence>
+ <xsd:element name="availRequest" type="ava:AvailRequest" minOccurs="1" maxOccurs="10">
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
+
+
+
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd
new file mode 100644
index 0000000000..4c437586ef
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<xsd:schema targetNamespace="http://www.example.org/price" xmlns:pri="http://www.example.org/price" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified">
+ <xsd:element name="priceQuote" type="pri:PriceQuote"/>
+ <xsd:complexType name="PriceRequest">
+ <xsd:sequence>
+ <xsd:element name="widgetId" type="xsd:integer"/>
+ <xsd:element name="price" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="PriceRequests">
+ <xsd:sequence>
+ <xsd:element name="priceRequest" type="pri:PriceRequest" minOccurs="1" maxOccurs="10"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ShipAddress">
+ <xsd:attribute name="street" type="xsd:string"/>
+ <xsd:attribute name="city" type="xsd:string"/>
+ <xsd:attribute name="state" type="xsd:string"/>
+ <xsd:attribute name="zip" type="xsd:string"/>
+ </xsd:complexType>
+ <xsd:complexType name="PriceQuote">
+ <xsd:sequence>
+ <xsd:element name="customerName" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="shipAddress" type="pri:ShipAddress" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="priceRequests" type="pri:PriceRequests"/>
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
+
+
+
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd
new file mode 100644
index 0000000000..4f64850056
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<xsd:schema targetNamespace="http://www.example.org/quote" xmlns:quo="http://www.example.org/quote" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified">
+ <xsd:element name="quote" type="quo:Quote"/>
+ <xsd:complexType name="Quote">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="address" type="xsd:string"/>
+ <xsd:element name="quoteResponse" type="quo:QuoteResponse" minOccurs="1" maxOccurs="10"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="QuoteResponse">
+ <xsd:sequence>
+ <xsd:element name="widgetId" type="xsd:integer"/>
+ <xsd:element name="unitPrice" type="xsd:float" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="requestedQuantity" type="xsd:int"/>
+ <xsd:element name="fillOrder" type="xsd:boolean"/>
+ <xsd:element name="shipDate" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="taxRate" type="xsd:float" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="totalCost" type="xsd:float" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl
new file mode 100644
index 0000000000..96c2af138a
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://quote.xquery" xmlns:tns="http://quote.xquery"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ava="http://www.example.org/avail"
+ xmlns:pri="http://www.example.org/price" xmlns:quo="http://www.example.org/quote" name="quotejoin">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://quote.xquery"
+ xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ava="http://www.example.org/avail"
+ xmlns:pri="http://www.example.org/price" xmlns:quo="http://www.example.org/quote">
+
+ <import namespace="http://www.example.org/avail" schemaLocation="AvailQuote.xsd" />
+ <import namespace="http://www.example.org/price" schemaLocation="PriceQuote.xsd" />
+ <import namespace="http://www.example.org/quote" schemaLocation="Quote.xsd" />
+
+ <element name="joinPriceAndAvailQuotes">
+ <complexType>
+ <sequence>
+ <element name="priceQuote" type="pri:PriceQuote" />
+ <element name="availQuote" type="ava:AvailQuote" />
+ <element name="taxRate" type="xsd:float" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="joinPriceAndAvailQuotesResponse">
+ <complexType>
+ <sequence>
+ <element name="joinPriceAndAvailQuotesReturn" type="quo:Quote" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="provideAvailQuote">
+ <complexType>
+ <sequence>
+ <element name="provideAvailQuote" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="provideAvailQuoteResponse">
+ <complexType>
+ <sequence>
+ <element name="provideAvailQuoteReturn" type="ava:AvailQuote" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="joinPriceAndAvailQuotesRequest">
+ <wsdl:part element="tns:joinPriceAndAvailQuotes" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="joinPriceAndAvailQuotesResponse">
+ <wsdl:part element="tns:joinPriceAndAvailQuotesResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:portType name="QuoteJoin">
+ <wsdl:operation name="joinPriceAndAvailQuotes">
+ <wsdl:input message="tns:joinPriceAndAvailQuotesRequest" name="joinPriceAndAvailQuotesRequest" />
+ <wsdl:output message="tns:joinPriceAndAvailQuotesResponse" name="joinPriceAndAvailQuotesResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="QuoteJoinSoapBinding" type="tns:QuoteJoin">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="joinPriceAndAvailQuotes">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="joinPriceAndAvailQuotesRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="joinPriceAndAvailQuotesResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="QuoteJoinService">
+ <wsdl:port binding="tns:QuoteJoinSoapBinding" name="QuoteJoinSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/QuoteJoinService" />
+ </wsdl:port>
+ </wsdl:service>
+
+
+
+ <wsdl:message name="provideAvailQuoteRequest">
+ <wsdl:part element="tns:provideAvailQuote" name="parameters" />
+ </wsdl:message>
+ <wsdl:message name="provideAvailQuoteResponse">
+ <wsdl:part element="tns:provideAvailQuoteResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:portType name="AvailQuoteProvider">
+ <wsdl:operation name="provideAvailQuote">
+ <wsdl:input message="tns:provideAvailQuoteRequest" name="provideAvailQuoteRequest" />
+ <wsdl:output message="tns:provideAvailQuoteResponse" name="provideAvailQuoteResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="AvailQuoteProviderSoapBinding" type="tns:AvailQuoteProvider">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="provideAvailQuote">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="provideAvailQuoteRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="provideAvailQuoteResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="AvailQuoteProviderService">
+ <wsdl:port binding="tns:AvailQuoteProviderSoapBinding" name="AvailQuoteProviderSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/AvailQuoteProviderService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/xqueryquotews.composite b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/xqueryquotews.composite
new file mode 100644
index 0000000000..cce6a728cc
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/xqueryquotews.composite
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://quote.xquery"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" xmlns:xq="http://quote.xquery"
+ name="xqueryquotews">
+
+ <dbsdo:import.sdo factory="org.example.avail.AvailFactory" />
+ <dbsdo:import.sdo factory="org.example.price.PriceFactory" />
+ <dbsdo:import.sdo factory="org.example.quote.QuoteFactory" />
+ <dbsdo:import.sdo location="wsdl/quotejoin.wsdl" />
+
+ <component name="QuoteJoinServerComponent">
+ <tuscany:implementation.xquery location="META-INF/sca/quote_join.xq" />
+ <service name="quoteJoin">
+ <interface.java interface="xquery.quote.QuoteJoin" />
+ <binding.ws wsdlElement="http://quote.xquery#wsdl.port(QuoteJoinService/QuoteJoinSoapPort)" />
+ </service>
+ <reference name="quoteCalculator" target="QuoteCalculatorServerComponent" />
+ </component>
+
+ <component name="QuoteCalculatorServerComponent">
+ <implementation.java class="xquery.quote.QuoteCalculatorImpl" />
+ </component>
+
+ <component name="AvailQuoteProviderComponent">
+ <implementation.java class="xquery.quote.AvailQuoteProviderImpl" />
+ <service name="AvailQuoteProviderService">
+ <interface.java interface="xquery.quote.AvailQuoteProviderService" />
+ <binding.ws
+ wsdlElement="http://quote.xquery#wsdl.port(AvailQuoteProviderService/AvailQuoteProviderSoapPort)" />
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite
new file mode 100644
index 0000000000..f078b9ee9f
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://quote.xquery/client"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:xq="http://quote.xquery/client"
+ name="xqueryquotewsclient">
+
+ <component name="QuoteJoinLocalComponent">
+ <implementation.java class="xquery.quote.QuoteJoinLocalImpl" />
+ <reference name="quoteJoin" target="QuoteJoinComponent" />
+ <reference name="propertiesQuoteJoin" target="QuoteJoinPropertiesComponent" />
+ <reference name="externalServicesQuoteJoin" target="QuoteJoinExternalReferencesComponent" />
+ </component>
+
+ <component name="QuoteJoinComponent">
+ <tuscany:implementation.xquery location="META-INF/sca/quote_join.xq" />
+ <reference name="quoteCalculator" target="QuoteCalculatorComponent" />
+ </component>
+
+ <component name="QuoteJoinPropertiesComponent">
+ <tuscany:implementation.xquery location="META-INF/sca/quote_join_properties.xq" />
+ <!-- Reset the default namespace as the sub-elements under pri:priceQuote are
+ unqualified -->
+ <property name="priceQuoteDoc">
+ <pri:priceQuote xmlns:pri="http://www.example.org/price" xmlns="">
+ <customerName>Acme Inc</customerName>
+ <shipAddress street="12 Springs Rd" city="Morris Plains" state="nj" zip="07960" />
+ <priceRequests>
+ <priceRequest>
+ <widgetId>12</widgetId>
+ <price>1.0</price>
+ </priceRequest>
+ <priceRequest>
+ <widgetId>134</widgetId>
+ <price>34.1</price>
+ </priceRequest>
+ <priceRequest>
+ <widgetId>211</widgetId>
+ <price>10.0</price>
+ </priceRequest>
+ </priceRequests>
+ </pri:priceQuote>
+ </property>
+ <!-- Reset the default namespace as the sub-elements under ava:availQuote are
+ unqualified -->
+
+ <property name="availQuoteDoc">
+ <ava:availQuote xmlns:ava="http://www.example.org/avail" xmlns="">
+ <availRequest>
+ <widgetId>12</widgetId>
+ <requestedQuantity>10</requestedQuantity>
+ <quantityAvail>true</quantityAvail>
+ <shipDate>2003-03-22</shipDate>
+ </availRequest>
+ <availRequest>
+ <widgetId>134</widgetId>
+ <requestedQuantity>345</requestedQuantity>
+ <quantityAvail>false</quantityAvail>
+ <shipDate>BackOrder</shipDate>
+ </availRequest>
+ <availRequest>
+ <widgetId>211</widgetId>
+ <requestedQuantity>100</requestedQuantity>
+ <quantityAvail>true</quantityAvail>
+ <shipDate>2003-04-21</shipDate>
+ </availRequest>
+ </ava:availQuote>
+ </property>
+ <property name="taxRate">0.1</property>
+ <reference name="quoteCalculator" target="QuoteCalculatorComponent" />
+ </component>
+
+ <component name="QuoteJoinExternalReferencesComponent">
+ <tuscany:implementation.xquery location="META-INF/sca/quote_join_external_references.xq" />
+ <reference name="quoteCalculator" target="QuoteCalculatorComponent" />
+ <reference name="priceQuoteProvider" target="PriceQuoteProviderComponent" />
+ </component>
+
+ <component name="QuoteCalculatorComponent">
+ <implementation.java class="xquery.quote.QuoteCalculatorImpl" />
+ </component>
+
+ <component name="PriceQuoteProviderComponent">
+ <implementation.java class="xquery.quote.PriceQuoteProviderImpl" />
+ </component>
+
+ <reference name="availQuoteProvider" promote="QuoteJoinExternalReferencesComponent/availQuoteProvider">
+ <interface.java interface="xquery.quote.AvailQuoteProviderService" />
+ <binding.ws wsdlElement="http://quote.xquery#wsdl.port(AvailQuoteProviderService/AvailQuoteProviderSoapPort)" />
+ </reference>
+ <reference name="quoteJoinWs" promote="QuoteJoinLocalComponent/quoteJoinWs">
+ <interface.java interface="xquery.quote.QuoteJoin" />
+ <binding.ws wsdlElement="http://quote.xquery#wsdl.port(QuoteJoinService/QuoteJoinSoapPort)" />
+ </reference>
+</composite>
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java b/tags/java/sca/1.0.1/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java
new file mode 100644
index 0000000000..9555532b3e
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java
@@ -0,0 +1,192 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner;
+import org.example.avail.AvailQuote;
+import org.example.avail.AvailRequest;
+import org.example.price.PriceQuote;
+import org.example.price.PriceRequest;
+import org.example.price.ShipAddress;
+import org.example.quote.Quote;
+import org.example.quote.QuoteResponse;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import commonj.sdo.DataObject;
+
+/**
+ * Integration test for the XQuery implementation type
+ * @version $Rev$ $Date$
+ * This test covers the most important integration scenarios for the xquery
+ * implementation type and its corresponding saxon data bindings:
+ *
+ * 1. There is a central component for invoking the different
+ * scenarios: QuoteJoinLocalComponent
+ * 2. It provides the following tests:
+ * - invoke XQuery component in the current assembly, by providing all needed
+ * information as input parameters
+ * - invoke XQuery component in external assembly, which is exposed as a web
+ * service
+ * - invoke XQuery component in the current assembly, which retrieves the needed
+ * information from the component properties
+ * - invoke XQuery component in the current assembly, which retrieves the needed
+ * information from its references to other components:
+ * - one of the components is in the current assembly
+ * - the other component is in anther assembly and it is exposed (and accessed)
+ * as web service
+ *
+ * 3. All of the XQuery components have reference to a component for calculation of the
+ * total price
+ * 4. SDO is used for data interchange
+ */
+public class XQueryQuoteClientTestCase {
+
+ public static boolean SHOW_DEBUG_MSG = false;
+
+ private SCADomain scaDomain;
+ private SCATestCaseRunner server;
+
+ private QuoteJoinLocal quoteJoinLocal;
+
+ @Before
+ public void startClient() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("xqueryquotewsclient.composite");
+
+ quoteJoinLocal = scaDomain.getService(QuoteJoinLocal.class, "QuoteJoinLocalComponent");
+
+ server = new SCATestCaseRunner(XQueryQuoteTestServer.class);
+ server.before();
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testQuoteJoin() {
+ AvailQuote availQuote = QuoteDataUtil.buildAvailQuoteData();
+ PriceQuote priceQuote = QuoteDataUtil.buildPriceQuoteData();
+
+ if (SHOW_DEBUG_MSG) {
+ System.out.println("Input quote for the price list:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)priceQuote, "priceQuote");
+ System.out.println();
+ System.out.println("Input quote for the availability:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)availQuote, "availQuote");
+ System.out.println();
+ }
+
+ Quote quote = quoteJoinLocal.joinPriceAndAvailQuotes(priceQuote, availQuote, 0.1f);
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from local join:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.1f);
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotes(priceQuote, availQuote, 0.2f);
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from local join (second invokation):");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.2f);
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotesWs(priceQuote, availQuote, 0.1f);
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from web service join:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.1f);
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotes();
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from properties join:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.1f);
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotes(0.1f);
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from external references join:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.1f);
+ }
+
+ @After
+ public void stopClient() throws Exception {
+ server.after();
+ scaDomain.close();
+ }
+
+ public static void assertQuote(AvailQuote availQuote, PriceQuote priceQuote, Quote quote, float taxRate) {
+ QuoteCalculatorImpl quoteCalculatorImpl = new QuoteCalculatorImpl();
+
+ TestCase.assertEquals(priceQuote.getCustomerName(), quote.getName());
+ ShipAddress shipAddress = priceQuote.getShipAddress();
+ TestCase.assertEquals(shipAddress.getStreet() + ","
+ + shipAddress.getCity()
+ + ","
+ + shipAddress.getState().toUpperCase()
+ + ","
+ + shipAddress.getZip(), quote.getAddress());
+ List availRequests = availQuote.getAvailRequest();
+ List priceRequests = priceQuote.getPriceRequests().getPriceRequest();
+ List quoteResponses = quote.getQuoteResponse();
+ TestCase.assertEquals(availRequests.size(), priceRequests.size());
+ TestCase.assertEquals(availRequests.size(), quoteResponses.size());
+
+ for (int i = 0; i < availRequests.size(); i++) {
+ AvailRequest availRequest = (AvailRequest)availRequests.get(i);
+ PriceRequest priceRequest = (PriceRequest)priceRequests.get(i);
+ QuoteResponse quoteResponse = (QuoteResponse)quoteResponses.get(i);
+ TestCase.assertEquals(availRequest.getWidgetId(), quoteResponse.getWidgetId());
+ TestCase.assertEquals(priceRequest.getPrice(), quoteResponse.getUnitPrice());
+ TestCase.assertEquals(availRequest.getRequestedQuantity(), quoteResponse.getRequestedQuantity());
+ TestCase.assertEquals(availRequest.isQuantityAvail(), quoteResponse.isFillOrder());
+ if (availRequest.getShipDate() == null) {
+ TestCase.assertNull(quoteResponse.getShipDate());
+ } else {
+ TestCase.assertEquals(availRequest.getShipDate(), quoteResponse.getShipDate());
+ }
+ TestCase.assertEquals(taxRate, quoteResponse.getTaxRate());
+ TestCase.assertEquals(quoteCalculatorImpl.calculateTotalPrice(taxRate,
+ availRequest.getRequestedQuantity(),
+ priceRequest.getPrice(),
+ availRequest.isQuantityAvail()),
+ quoteResponse.getTotalCost());
+ }
+ }
+}
diff --git a/tags/java/sca/1.0.1/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java b/tags/java/sca/1.0.1/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java
new file mode 100644
index 0000000000..9a4be5bda6
--- /dev/null
+++ b/tags/java/sca/1.0.1/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class XQueryQuoteTestServer {
+ private SCADomain scaDomain;
+
+ @Before
+ public void startServer() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("xqueryquotews.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ }
+}