summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery')
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java28
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java27
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java27
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java28
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java27
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java28
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java32
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java26
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java107
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java34
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java34
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java67
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java145
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java39
16 files changed, 717 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java
new file mode 100644
index 0000000000..8a42136b5d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/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/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java
new file mode 100644
index 0000000000..41d78683cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/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/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java
new file mode 100644
index 0000000000..f744a59744
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/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/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java
new file mode 100644
index 0000000000..374c0825e9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/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/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java
new file mode 100644
index 0000000000..fbe38b8269
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/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/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java
new file mode 100644
index 0000000000..d2d175430b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/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/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java
new file mode 100644
index 0000000000..06c3945a6e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/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/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java
new file mode 100644
index 0000000000..1ecdf120c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+import org.example.quote.Quote;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface PropertiesQuoteJoin {
+ @RequestWrapper(className="xquery.quote.joinPriceAndAvailQuotes")
+ @ResponseWrapper(className="xquery.quote.joinPriceAndAvailQuotesResponse")
+ public Quote joinPriceAndAvailQuotes();
+}
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java
new file mode 100644
index 0000000000..85508eaa46
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/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/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java
new file mode 100644
index 0000000000..26331381a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/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/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java
new file mode 100644
index 0000000000..8ed02dc1ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/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/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java
new file mode 100644
index 0000000000..425867055b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.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 javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+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 {
+ @RequestWrapper(className="xquery.quote.joinPriceAndAvailQuotes")
+ @ResponseWrapper(className="xquery.quote.joinPriceAndAvailQuotesResponse")
+ public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate);
+}
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java
new file mode 100644
index 0000000000..cfd201f883
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/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/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java
new file mode 100644
index 0000000000..20fe73fd92
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/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/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java
new file mode 100644
index 0000000000..adc852acd4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/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: 577067 $ $Date: 2007-09-18 22:10:03 +0100 (Tue, 18 Sep 2007) $
+ * 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/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java
new file mode 100644
index 0000000000..3fa3cdb637
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/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.");
+ }
+}