summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions')
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/pom.xml57
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/main/java/calendar/Calendar.java28
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/main/java/calendar/CalendarImpl.java45
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/main/resources/META-INF/sca-contribution.xml22
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/main/resources/calendar.composite29
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/test/java/calendar/CalendarTestCase.java47
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/test/resources/calendar.composite29
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/car-contribution/pom.xml62
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/car-contribution/src/main/java/scatours/car/CarImpl.java100
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/car-contribution/src/main/java/scatours/car/CarInfo.java120
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/car-contribution/src/main/resources/META-INF/sca-contribution.xml23
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/build.xml61
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/pom.xml56
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/Book.java27
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/Search.java33
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/SearchCallback.java27
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/TripItem.java219
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/TripLeg.java97
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/resources/META-INF/sca-contribution.xml22
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/pom.xml131
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/main/java/payment/creditcard/CreditCardPaymentImpl.java44
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/main/resources/CreditCardPayment.wsdl116
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/main/resources/META-INF/sca-contribution.xml22
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/test/java/payment/creditcard/CreditCardPaymentTestCase.java83
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/test/resources/META-INF/sca-contribution.xml22
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/test/resources/creditcard.composite34
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/currency-contribution/pom.xml57
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/currency-contribution/src/main/java/scatours/currencyconverter/CurrencyConverter.java33
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/currency-contribution/src/main/java/scatours/currencyconverter/CurrencyConverterImpl.java54
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/currency-contribution/src/main/resources/META-INF/sca-contribution.xml22
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/pom.xml124
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/main/java/scatours/emailgateway/EmailGatewayImpl.java36
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/main/resources/EmailGateway.wsdl89
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/main/resources/META-INF/sca-contribution.xml22
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/java/scatours/emailgateway/EmailGatewayTestCase.java80
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/java/scatours/emailgateway/client/EmailGatewayClientImpl.java41
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/resources/EmailGatewayImpl.java36
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/resources/META-INF/sca-contribution.xml22
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/resources/emailgateway.composite37
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/flight-contribution/pom.xml62
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/flight-contribution/src/main/java/scatours/flight/FlightImpl.java127
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/flight-contribution/src/main/java/scatours/flight/FlightInfo.java142
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/flight-contribution/src/main/resources/META-INF/sca-contribution.xml23
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/hotel-contribution/pom.xml62
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/hotel-contribution/src/main/java/scatours/hotel/HotelImpl.java116
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/hotel-contribution/src/main/java/scatours/hotel/HotelInfo.java120
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/hotel-contribution/src/main/resources/META-INF/sca-contribution.xml23
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/pom.xml155
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/payment/PaymentImpl.java88
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/payment/creditcard/CreditCardPaymentImpl.java50
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/customer/Customer.java70
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/customer/CustomerNotFoundException.java58
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/customer/CustomerRegistry.java39
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/customer/CustomerRegistryImpl.java112
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/emailgateway/EmailGateway.java30
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/emailgateway/EmailGatewayImpl.java35
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/CreditCardPayment.wsdl130
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/META-INF/sca-contribution.xml22
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/Payment.wsdl83
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/definitions.xml33
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/payment.composite46
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/test/java/payment/PaymentTestCase.java77
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/pom.xml58
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/pom.xml94
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursBooking.java32
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursCart.java33
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursImpl.java99
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursSearch.java32
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/resources/META-INF/sca-contribution.xml26
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/pom.xml119
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/src/main/java/scatours/shoppingcart/ShoppingCart.java39
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/src/main/java/scatours/shoppingcart/ShoppingCartImpl.java95
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/src/main/resources/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/src/main/resources/Payment.wsdl83
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/travelcatalog-contribution/pom.xml74
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/travelcatalog-contribution/src/main/java/scatours/travelcatalog/TravelCatalogImpl.java132
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/travelcatalog-contribution/src/main/java/scatours/travelcatalog/TravelCatalogSearch.java32
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/travelcatalog-contribution/src/main/resources/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/trip-contribution/pom.xml62
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/trip-contribution/src/main/java/scatours/trip/TripImpl.java106
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/trip-contribution/src/main/java/scatours/trip/TripInfo.java142
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/trip-contribution/src/main/resources/META-INF/sca-contribution.xml23
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/build.xml61
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/pom.xml74
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/src/main/java/scatours/tripbooking/TripBooking.java32
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/src/main/java/scatours/tripbooking/TripBookingImpl.java135
-rw-r--r--sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/src/main/resources/META-INF/sca-contribution.xml25
87 files changed, 5568 insertions, 0 deletions
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/pom.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/pom.xml
new file mode 100644
index 0000000000..30c3ef2cc0
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/pom.xml
@@ -0,0 +1,57 @@
+<?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.6-SNAPSHOT</version>
+ <!--relativePath>../../pom.xml</relativePath-->
+ </parent>
+ <artifactId>scatours-calendar-contribution</artifactId>
+ <name>Apache Tuscany SCA Tours Calendar Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/main/java/calendar/Calendar.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/main/java/calendar/Calendar.java
new file mode 100644
index 0000000000..90736b92b4
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/main/java/calendar/Calendar.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 calendar;
+
+/**
+ * The Add service interface
+ */
+public interface Calendar {
+
+ String getEndDate(String startDate, int duration);
+
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/main/java/calendar/CalendarImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/main/java/calendar/CalendarImpl.java
new file mode 100644
index 0000000000..5aee34431c
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/main/java/calendar/CalendarImpl.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calendar;
+
+import java.text.DateFormat;
+import java.util.Date;
+
+/**
+ * An implementation of the Add service
+ */
+public class CalendarImpl implements Calendar {
+
+ public String getEndDate(String startDate, int duration){
+ String returnDate = "Invalid Date";
+
+ try {
+ Date date = DateFormat.getInstance().parse(startDate);
+ java.util.Calendar calendar = java.util.Calendar.getInstance();
+ calendar.setTime(date);
+ calendar.add(java.util.Calendar.DATE, duration);
+ returnDate = DateFormat.getInstance().format(calendar.getTime());
+ } catch (Exception ex){
+ // do nothing
+ System.out.println(ex.toString());
+ }
+
+ return returnDate;
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..327ce07643
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <export.java package="scatours.calendar"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/main/resources/calendar.composite b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/main/resources/calendar.composite
new file mode 100644
index 0000000000..b72c450446
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/main/resources/calendar.composite
@@ -0,0 +1,29 @@
+<?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://travel"
+ xmlns:sample="http://travel"
+ name="calendar">
+
+ <component name="CalendarComponent">
+ <implementation.java class="calendar.CalendarImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/test/java/calendar/CalendarTestCase.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/test/java/calendar/CalendarTestCase.java
new file mode 100644
index 0000000000..fee00fbb0a
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/test/java/calendar/CalendarTestCase.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calendar;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalendarTestCase extends TestCase {
+
+ private Calendar calendar;
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("calendar.composite");
+ calendar = scaDomain.getService(Calendar.class, "CalendarComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testCalculator() throws Exception {
+ System.out.println(calendar.getEndDate("07/10/96 04:05", 3));
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/test/resources/calendar.composite b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/test/resources/calendar.composite
new file mode 100644
index 0000000000..b72c450446
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/calendar-contribution/src/test/resources/calendar.composite
@@ -0,0 +1,29 @@
+<?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://travel"
+ xmlns:sample="http://travel"
+ name="calendar">
+
+ <component name="CalendarComponent">
+ <implementation.java class="calendar.CalendarImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/car-contribution/pom.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/car-contribution/pom.xml
new file mode 100644
index 0000000000..0e20cacb3a
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/car-contribution/pom.xml
@@ -0,0 +1,62 @@
+<?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.6-SNAPSHOT</version>
+ <!--relativePath>../../pom.xml</relativePath-->
+ </parent>
+ <artifactId>scatours-car-contribution</artifactId>
+ <name>Apache Tuscany SCA Tours Car Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-data-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-common-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/car-contribution/src/main/java/scatours/car/CarImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/car-contribution/src/main/java/scatours/car/CarImpl.java
new file mode 100644
index 0000000000..059365a9ab
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/car-contribution/src/main/java/scatours/car/CarImpl.java
@@ -0,0 +1,100 @@
+/*
+ * 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 scatours.car;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import scatours.common.Book;
+import scatours.common.Search;
+import scatours.common.SearchCallback;
+import scatours.common.TripItem;
+import scatours.common.TripLeg;
+
+/**
+ * An implementation of the Hotel service
+ */
+@Scope("STATELESS")
+@Service(interfaces={Search.class, Book.class})
+public class CarImpl implements Search, Book {
+
+ private List<CarInfo> cars = new ArrayList<CarInfo>();
+
+ @Callback
+ protected SearchCallback searchCallback;
+
+ @Init
+ public void init() {
+ cars.add(new CarInfo("Premier Cars",
+ "BMW 5 Series",
+ "FLR",
+ "06/12/09",
+ "5",
+ 100.00,
+ "EUR",
+ "http://localhost:8085/tbd" ));
+ cars.add(new CarInfo("Premier Cars",
+ "Ford Focus",
+ "FLR",
+ "06/12/09",
+ "4",
+ 60.00,
+ "EUR",
+ "http://localhost:8085/tbd" ));
+ }
+
+ public TripItem[] searchSynch(TripLeg tripLeg) {
+ List<TripItem> items = new ArrayList<TripItem>();
+
+ // find available hotels
+ for(CarInfo car : cars){
+ if (car.getLocation().equals(tripLeg.getToLocation())){
+ TripItem item = new TripItem("",
+ "",
+ TripItem.CAR,
+ car.getName(),
+ car.getDescription(),
+ car.getLocation(),
+ tripLeg.getFromDate(),
+ tripLeg.getToDate(),
+ car.getPricePerDay(),
+ car.getCurrency(),
+ car.getLink());
+ items.add(item);
+ }
+ }
+
+ return items.toArray(new TripItem[items.size()]);
+ }
+
+ public void searchAsynch(TripLeg tripLeg) {
+
+ // return available hotels
+ searchCallback.searchResults(searchSynch(tripLeg));
+ }
+
+ public String book(TripItem tripItem) {
+ return "car1";
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/car-contribution/src/main/java/scatours/car/CarInfo.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/car-contribution/src/main/java/scatours/car/CarInfo.java
new file mode 100644
index 0000000000..2538c51e09
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/car-contribution/src/main/java/scatours/car/CarInfo.java
@@ -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.
+ */
+
+package scatours.car;
+
+
+public class CarInfo {
+
+ private String name;
+ private String description;
+ private String location;
+ private String date;
+ private String seats;
+ private double pricePerDay;
+ private String currency;
+ private String link;
+
+ public CarInfo() {
+ }
+
+ public CarInfo(String name,
+ String description,
+ String location,
+ String date,
+ String seats,
+ double pricePerDay,
+ String currency,
+ String link) {
+
+ this.name = name;
+ this.description = description;
+ this.location = location;
+ this.date = date;
+ this.seats = seats;
+ this.pricePerDay = pricePerDay;
+ this.currency = currency;
+ this.link = link;
+ }
+
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getDate() {
+ return date;
+ }
+
+ public void setDate(String date) {
+ this.date = date;
+ }
+
+ public String getSeats() {
+ return seats;
+ }
+
+ public void setSeats(String seats) {
+ this.seats = seats;
+ }
+
+ public double getPricePerDay() {
+ return pricePerDay;
+ }
+
+ public void setPricePerDay(double pricePerDay) {
+ this.pricePerDay = pricePerDay;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/car-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/car-contribution/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..f9c448e8ee
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/car-contribution/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="scatours.common"/>
+ <export.java package="scatours.car"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/build.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/build.xml
new file mode 100644
index 0000000000..b4fbc726cf
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/build.xml
@@ -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.
+-->
+<project name="gettingstarted" default="compile">
+ <property environment="env"/>
+
+ <target name="compile">
+ <mkdir dir="target/classes"/>
+ <javac srcdir="src" destdir="target/classes"
+ debug="on" source="1.5" target="1.5">
+ <classpath>
+ <pathelement location="${env.TUSCANY}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <target name="run">
+ <java classname="client.CurrencyConverterClient" fork="true">
+ <classpath>
+ <pathelement path="src"/>
+ <pathelement path="target/classes"/>
+ <pathelement location="${env.TUSCANY}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="runtrip">
+ <java classname="client.TripClient" fork="true">
+ <classpath>
+ <pathelement path="src"/>
+ <pathelement path="target/classes"/>
+ <pathelement location="${env.TUSCANY}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="runtripws">
+ <java classname="client.TripWsClient" fork="true">
+ <classpath>
+ <pathelement path="src"/>
+ <pathelement path="target/classes"/>
+ <pathelement location="${env.TUSCANY}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/pom.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/pom.xml
new file mode 100644
index 0000000000..e1899df159
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/pom.xml
@@ -0,0 +1,56 @@
+<?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.6-SNAPSHOT</version>
+ <!--relativePath>../../pom.xml</relativePath-->
+ </parent>
+ <artifactId>scatours-common-contribution</artifactId>
+ <name>Apache Tuscany SCA Tours Common Artefacts Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-data-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/Book.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/Book.java
new file mode 100644
index 0000000000..630ba1dfe5
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/Book.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 scatours.common;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Book {
+ String book(TripItem tripItem);
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/Search.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/Search.java
new file mode 100644
index 0000000000..67335e72dc
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/Search.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours.common;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Callback(SearchCallback.class)
+public interface Search {
+ TripItem[] searchSynch(TripLeg tripLeg);
+
+ @OneWay
+ void searchAsynch(TripLeg tripLeg);
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/SearchCallback.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/SearchCallback.java
new file mode 100644
index 0000000000..7c3a0ed45c
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/SearchCallback.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 scatours.common;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface SearchCallback {
+ void searchResults(TripItem[] items);
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/TripItem.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/TripItem.java
new file mode 100644
index 0000000000..1fd78c8dd5
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/TripItem.java
@@ -0,0 +1,219 @@
+/*
+ * 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 scatours.common;
+
+
+
+public class TripItem {
+
+ public static String FLIGHT = "Flight";
+ public static String HOTEL = "Hotel";
+ public static String CAR = "Car";
+ public static String TRIP = "Trip";
+
+ private String id;
+ private String tripId;
+ private String type;
+ private String name;
+ private String description;
+ private String location;
+ private String fromDate;
+ private String toDate;
+ private double price;
+ private String currency;
+ private String link;
+ private TripItem[] tripItems; // used for a trip made up of trip items
+ private String customerDetails;
+ private String agentDetails;
+ private String bookingCode;
+
+ public TripItem() {
+ }
+
+ public TripItem(TripItem item) {
+ this.id = item.getId();
+ this.tripId = item.getTripId();
+ this.type = item.getType();
+ this.name = item.getName();
+ this.description = item.getDescription();
+ this.location = item.getLocation();
+ this.fromDate = item.getFromDate();
+ this.toDate = item.getToDate();
+ this.price = item.getPrice();
+ this.currency = item.getCurrency();
+ this.link = item.getLink();
+ }
+
+ public TripItem(String id,
+ String tripId,
+ String type,
+ String name,
+ String description,
+ String location,
+ String fromDate,
+ String toDate,
+ double price,
+ String currency,
+ String link) {
+ this.id = id;
+ this.tripId = tripId;
+ this.type = type;
+ this.name = name;
+ this.description = description;
+ this.location = location;
+ this.fromDate = fromDate;
+ this.toDate = toDate;
+ this.price = price;
+ this.currency = currency;
+ this.link = link;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getTripId() {
+ return tripId;
+ }
+
+ public void setTripId(String tripId) {
+ this.tripId = tripId;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getFromDate() {
+ return fromDate;
+ }
+
+ public void setFromDate(String fromDate) {
+ this.fromDate = fromDate;
+ }
+
+ public String getToDate() {
+ return toDate;
+ }
+
+ public void setToDate(String toDate) {
+ this.toDate = toDate;
+ }
+
+ public double getPrice() {
+ return price;
+ }
+
+ public void setPrice(double price) {
+ this.price = price;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+
+ public TripItem[] getTripItems() {
+ return tripItems;
+ }
+
+ public void setTripItems(TripItem[] tripItems) {
+ this.tripItems = tripItems;
+ }
+
+ public String getCustomerDetails() {
+ return customerDetails;
+ }
+
+ public void setCustomerDetails(String customerDetails) {
+ this.customerDetails = customerDetails;
+ }
+
+ public String getAgentDetails() {
+ return agentDetails;
+ }
+
+ public void setAgentDetails(String agentDetails) {
+ this.agentDetails = agentDetails;
+ }
+
+ public String getBookingCode() {
+ return bookingCode;
+ }
+
+ public void setBookingCode(String bookingCode) {
+ this.bookingCode = bookingCode;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+
+ if (obj instanceof TripItem){
+ if (((TripItem)obj).getId().equals(getId())){
+ return true;
+ }
+ }
+
+ return super.equals(obj);
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/TripLeg.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/TripLeg.java
new file mode 100644
index 0000000000..1af33aa6f9
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/java/scatours/common/TripLeg.java
@@ -0,0 +1,97 @@
+/*
+ * 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 scatours.common;
+
+
+public class TripLeg {
+
+ private String id;
+ private String fromLocation;
+ private String toLocation;
+ private String fromDate;
+ private String toDate;
+ private String noOfPeople;
+
+
+ public TripLeg() {
+ }
+
+ public TripLeg(String id,
+ String fromLocation,
+ String toLocation,
+ String fromDate,
+ String toDate,
+ String noOfPeople) {
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getFromLocation() {
+ return fromLocation;
+ }
+
+ public void setFromLocation(String fromLocation) {
+ this.fromLocation = fromLocation;
+ }
+
+ public String getToLocation() {
+ return toLocation;
+ }
+
+ public void setToLocation(String toLocation) {
+ this.toLocation = toLocation;
+ }
+
+ public String getFromDate() {
+ return fromDate;
+ }
+
+ public void setFromDate(String fromDate) {
+ this.fromDate = fromDate;
+ }
+
+ public String getToDate() {
+ return toDate;
+ }
+
+ public void setToDate(String toDate) {
+ this.toDate = toDate;
+ }
+
+ public String getNoOfPeople() {
+ return noOfPeople;
+ }
+
+ public void setNoOfPeople(String noOfPeople) {
+ this.noOfPeople = noOfPeople;
+ }
+
+
+
+
+
+
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..c2b9fd12c7
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/common-contribution/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <export.java package="scatours.common"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/pom.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/pom.xml
new file mode 100644
index 0000000000..94f0e80f77
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/pom.xml
@@ -0,0 +1,131 @@
+<?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.6-SNAPSHOT</version>
+ <!--relativePath>../../pom.xml</relativePath-->
+ </parent>
+ <artifactId>scatours-creditcard-payment-jaxb-contribution</artifactId>
+ <name>Apache Tuscany SCA Tours Credit Card Payment Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</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-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/jaxws-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <version>1.9</version>
+ <executions>
+ <execution>
+ <id>wsimport</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ <configuration>
+ <packageName>payment.creditcard</packageName>
+ <wsdlDirectory>${basedir}/src/main/resources
+ </wsdlDirectory>
+ <wsdlFiles>
+ <wsdlFile>CreditCardPayment.wsdl</wsdlFile>
+ </wsdlFiles>
+ <sourceDestDir>${project.build.directory}/jaxws-source
+ </sourceDestDir>
+ <verbose>false</verbose>
+ <xnocompile>true</xnocompile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/main/java/payment/creditcard/CreditCardPaymentImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/main/java/payment/creditcard/CreditCardPaymentImpl.java
new file mode 100644
index 0000000000..b7d44c1abe
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/main/java/payment/creditcard/CreditCardPaymentImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package payment.creditcard;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ */
+@Service(CreditCardPayment.class)
+public class CreditCardPaymentImpl implements CreditCardPayment {
+
+ public String authorize(CreditCardDetailsType creditCard, float amount) {
+ if (creditCard != null){
+ System.out.println("Checking card: name = " +
+ creditCard.getCardOwner().getName() +
+ " number = " +
+ creditCard.getCreditCardNumber() +
+ " for amount " +
+ amount);
+ } else {
+ System.out.println("Checking card is null");
+ }
+
+ return "OK";
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/main/resources/CreditCardPayment.wsdl
new file mode 100644
index 0000000000..1813c77436
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/main/resources/CreditCardPayment.wsdl
@@ -0,0 +1,116 @@
+<?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 name="CreditCardPayment"
+ targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/">
+
+ <xsd:element name="authorize" type="tns:AuthorizeType"/>
+ <xsd:complexType name="AuthorizeType">
+ <xsd:sequence>
+ <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element>
+ <xsd:element name="Amount" type="xsd:float"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="authorizeResponse" type="tns:AuthorizeResponseType"/>
+ <xsd:complexType name="AuthorizeResponseType">
+ <xsd:sequence>
+ <xsd:element name="Status" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="CreditCardDetailsType">
+ <xsd:sequence>
+ <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" />
+ <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" />
+ <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" />
+ <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" />
+ <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" />
+ <xsd:element name="CVV2" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:simpleType name="CreditCardTypeType">
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="Visa" />
+ <xsd:enumeration value="MasterCard" />
+ <xsd:enumeration value="Discover" />
+ <xsd:enumeration value="Amex" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="PayerType">
+ <xsd:sequence>
+ <xsd:element name="Name" type="xsd:string" />
+ <xsd:element name="Address" type="tns:AddressType" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AddressType">
+ <xsd:sequence>
+ <xsd:element name="Street" type="xsd:string" />
+ <xsd:element name="City" type="xsd:string" />
+ <xsd:element name="State" type="xsd:string" />
+ <xsd:element name="ZipCode" type="xsd:string" />
+ <xsd:element name="HomePhone" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="AuthorizeRequest">
+ <wsdl:part name="parameters" element="tns:authorize"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="AuthorizeResponse">
+ <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="CreditCardPayment">
+ <wsdl:operation name="authorize">
+ <wsdl:input message="tns:AuthorizeRequest"></wsdl:input>
+ <wsdl:output message="tns:AuthorizeResponse"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="authorize">
+ <soap:operation soapAction="http://www.tuscanyscatours.com/CreditCardPayment/authorize" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CreditCardPaymentService">
+ <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding">
+ <soap:address location="http://localhost:8080/CreditCardPayment" />
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="CreditCardPaymentLinkType">
+ <plnk:role name="forward" portType="tns:CreditCardPayment"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..8faf8db4ee
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <export.java package="payment.creditcard"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/test/java/payment/creditcard/CreditCardPaymentTestCase.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/test/java/payment/creditcard/CreditCardPaymentTestCase.java
new file mode 100644
index 0000000000..0c25509ab3
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/test/java/payment/creditcard/CreditCardPaymentTestCase.java
@@ -0,0 +1,83 @@
+/*
+ * 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 payment.creditcard;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class CreditCardPaymentTestCase {
+ private static SCANode node;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ SCANodeFactory factory = SCANodeFactory.newInstance();
+ node = factory.createSCANodeFromClassLoader("creditcard.composite", CreditCardPayment.class.getClassLoader());
+ node.start();
+ }
+
+ @Test
+ public void testCreditCardPayment() {
+ SCAClient client = (SCAClient) node;
+ CreditCardPayment cc = client.getService(CreditCardPayment.class, "CreditCardPaymentComponent/CreditCardPayment");
+
+ ObjectFactory objectFactory = new ObjectFactory();
+ CreditCardDetailsType ccDetails = objectFactory.createCreditCardDetailsType();
+ ccDetails.setCreditCardType(CreditCardTypeType.fromValue("Visa"));
+ PayerType ccOwner = objectFactory.createPayerType();
+ ccOwner.setName("Fred");
+ ccDetails.setCardOwner(ccOwner);
+
+ System.out.println(cc.authorize(ccDetails, 100.00f));
+ }
+
+ @Test
+ @Ignore
+ public void testWaitForInput() {
+ System.out.println("Press a key to end");
+ try {
+ System.in.read();
+ } catch (Exception ex) {
+ }
+ System.out.println("Shutting down");
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ if (node != null) {
+ node.stop();
+ node = null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/test/resources/META-INF/sca-contribution.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/test/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..666c488b6d
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/test/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="payment.creditcard"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/test/resources/creditcard.composite b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/test/resources/creditcard.composite
new file mode 100644
index 0000000000..d0721a8bae
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/creditcard-payment-jaxb-contribution/src/test/resources/creditcard.composite
@@ -0,0 +1,34 @@
+<?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://creditcard"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:c="http://creditcard"
+ name="creditcard">
+
+ <component name="CreditCardPaymentComponent">
+ <implementation.java class="payment.creditcard.CreditCardPaymentImpl" />
+ <service name="CreditCardPayment">
+ <binding.ws uri="http://localhost:8081/CreditCardPayment" />
+ <binding.sca/>
+ </service>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/currency-contribution/pom.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/currency-contribution/pom.xml
new file mode 100644
index 0000000000..61ef0b6752
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/currency-contribution/pom.xml
@@ -0,0 +1,57 @@
+<?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.6-SNAPSHOT</version>
+ <!--relativePath>../../pom.xml</relativePath-->
+ </parent>
+ <artifactId>scatours-currency-contribution</artifactId>
+ <name>Apache Tuscany SCA Tours Currency Converter Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/currency-contribution/src/main/java/scatours/currencyconverter/CurrencyConverter.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/currency-contribution/src/main/java/scatours/currencyconverter/CurrencyConverter.java
new file mode 100644
index 0000000000..9b3851721f
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/currency-contribution/src/main/java/scatours/currencyconverter/CurrencyConverter.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.currencyconverter;
+
+/**
+ * The CurrencyConverter service interface
+ */
+public interface CurrencyConverter {
+
+ double getExchangeRate(String fromCurrencyCode,
+ String toCurrencyCode);
+
+ double convert(String fromCurrencyCode,
+ String toCurrencyCode,
+ double amount);
+
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/currency-contribution/src/main/java/scatours/currencyconverter/CurrencyConverterImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/currency-contribution/src/main/java/scatours/currencyconverter/CurrencyConverterImpl.java
new file mode 100644
index 0000000000..eddc59f555
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/currency-contribution/src/main/java/scatours/currencyconverter/CurrencyConverterImpl.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.currencyconverter;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of the CurrencyConverter service
+ */
+@Service(interfaces={CurrencyConverter.class})
+public class CurrencyConverterImpl implements CurrencyConverter {
+
+ // currency index
+ private Map<String, Integer> currencyIndex = new HashMap<String, Integer>();
+
+ // exchange rates
+ private final double rates [][] = {{ 1.00, 0.50, 0.66 },
+ { 2.00, 1.00, 1.33 },
+ { 1.50, 0.75, 1.00 } } ;
+
+ public CurrencyConverterImpl(){
+ currencyIndex.put("USD", new Integer(0));
+ currencyIndex.put("GBP", new Integer(1));
+ currencyIndex.put("EUR", new Integer(2));
+ }
+
+ public double getExchangeRate(String fromCurrencyCode, String toCurrencyCode){
+ return rates[currencyIndex.get(fromCurrencyCode).intValue()]
+ [currencyIndex.get(toCurrencyCode).intValue()];
+ }
+
+ public double convert(String fromCurrencyCode, String toCurrencyCode, double amount){
+ return amount * getExchangeRate(fromCurrencyCode, toCurrencyCode);
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/currency-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/currency-contribution/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..549a3bc7a3
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/currency-contribution/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <export.java package="scatours.currencyconverter"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/pom.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/pom.xml
new file mode 100644
index 0000000000..34cf7d2512
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/pom.xml
@@ -0,0 +1,124 @@
+<?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.6-SNAPSHOT</version>
+ <!--relativePath>../../pom.xml</relativePath-->
+ </parent>
+ <artifactId>scatours-emailgateway-contribution</artifactId>
+ <name>Apache Tuscany SCA Tours Email Gateway Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</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-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/jaxws-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <version>1.9</version>
+ <executions>
+ <execution>
+ <id>wsimport</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ <configuration>
+ <packageName>scatours.emailgateway</packageName>
+ <wsdlDirectory>${basedir}/src/main/resources
+ </wsdlDirectory>
+ <wsdlFiles>
+ <wsdlFile>EmailGateway.wsdl</wsdlFile>
+ </wsdlFiles>
+ <sourceDestDir>${project.build.directory}/jaxws-source
+ </sourceDestDir>
+ <verbose>false</verbose>
+ <xnocompile>true</xnocompile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/main/java/scatours/emailgateway/EmailGatewayImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/main/java/scatours/emailgateway/EmailGatewayImpl.java
new file mode 100644
index 0000000000..6e971c3267
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/main/java/scatours/emailgateway/EmailGatewayImpl.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours.emailgateway;
+
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ *
+ */
+@Service(EmailGateway.class)
+public class EmailGatewayImpl implements EmailGateway {
+
+ public String sendEmail(EmailType email) {
+ System.out.println("Sending mail to " + email.getTo());
+ return "SENT";
+ }
+
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/main/resources/EmailGateway.wsdl b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/main/resources/EmailGateway.wsdl
new file mode 100644
index 0000000000..7c5c190e1e
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/main/resources/EmailGateway.wsdl
@@ -0,0 +1,89 @@
+<?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 name="EmailGateway"
+ targetNamespace="http://www.tuscanyscatours.com/EmailGateway/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.tuscanyscatours.com/EmailGateway/"
+ xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/">
+
+ <xsd:element name="sendEmail" type="tns:SendEmailType"/>
+ <xsd:complexType name="SendEmailType">
+ <xsd:sequence>
+ <xsd:element name="Email" type="tns:EmailType"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="sendEmailResponse" type="tns:SendEmailResponseType"/>
+ <xsd:complexType name="SendEmailResponseType">
+ <xsd:sequence>
+ <xsd:element name="Status" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="EmailType">
+ <xsd:sequence>
+ <xsd:element name="To" type="xsd:string"/>
+ <xsd:element name="Title" type="xsd:string"/>
+ <xsd:element name="Body" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="SendEmailRequest">
+ <wsdl:part name="parameters" element="tns:sendEmail"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="SendEmailResponse">
+ <wsdl:part name="parameters" element="tns:sendEmailResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="EmailGateway">
+ <wsdl:operation name="sendEmail">
+ <wsdl:input message="tns:SendEmailRequest"></wsdl:input>
+ <wsdl:output message="tns:SendEmailResponse"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="EmailGatwayBinding" type="tns:EmailGateway">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="sendEmail">
+ <soap:operation soapAction="http://www.tuscanyscatours.com/EmailGateway/sendEmail" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="EmailGatewayService">
+ <wsdl:port name="EmailGatewayPort" binding="tns:EmailGatwayBinding">
+ <soap:address location="http://localhost:8080/EmailGateway" />
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="EmailGatewayLinkType">
+ <plnk:role name="forward" portType="tns:EmailGateway"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..d77df2fd7e
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <export.java package="scatours.emailgateway"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/java/scatours/emailgateway/EmailGatewayTestCase.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/java/scatours/emailgateway/EmailGatewayTestCase.java
new file mode 100644
index 0000000000..1dfaf14eb0
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/java/scatours/emailgateway/EmailGatewayTestCase.java
@@ -0,0 +1,80 @@
+/*
+ * 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 scatours.emailgateway;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class EmailGatewayTestCase {
+ private static SCANode node;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ SCANodeFactory factory = SCANodeFactory.newInstance();
+ node = factory.createSCANodeFromClassLoader("emailgateway.composite", EmailGateway.class.getClassLoader());
+ node.start();
+ }
+
+ @Test
+ public void testEmailGateway() {
+ SCAClient client = (SCAClient) node;
+ EmailGateway cc = client.getService(EmailGateway.class, "EmailGatewayClient");
+ ObjectFactory objectFactory = new ObjectFactory();
+ EmailType email = objectFactory.createEmailType();
+ email.setTo("Fred");
+ email.setTitle("An email");
+ email.setBody("A message");
+ System.out.println(cc.sendEmail(email));
+ }
+
+ @Test
+ //@Ignore
+ public void testWaitForInput() {
+ System.out.println("Press a key to end");
+ /* try {
+ System.in.read();
+ } catch (Exception ex) {
+ }
+ System.out.println("Shutting down");
+*/
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ if (node != null) {
+ node.stop();
+ node = null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/java/scatours/emailgateway/client/EmailGatewayClientImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/java/scatours/emailgateway/client/EmailGatewayClientImpl.java
new file mode 100644
index 0000000000..074c3bffa4
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/java/scatours/emailgateway/client/EmailGatewayClientImpl.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours.emailgateway.client;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import scatours.emailgateway.EmailGateway;
+import scatours.emailgateway.EmailType;
+
+/**
+ *
+ */
+@Service(EmailGateway.class)
+public class EmailGatewayClientImpl implements EmailGateway {
+ @Reference
+ protected EmailGateway emailGateway;
+
+ public String sendEmail(EmailType email) {
+ // Delegate the external web service
+ return emailGateway.sendEmail(email);
+ }
+
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/resources/EmailGatewayImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/resources/EmailGatewayImpl.java
new file mode 100644
index 0000000000..6e971c3267
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/resources/EmailGatewayImpl.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours.emailgateway;
+
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ *
+ */
+@Service(EmailGateway.class)
+public class EmailGatewayImpl implements EmailGateway {
+
+ public String sendEmail(EmailType email) {
+ System.out.println("Sending mail to " + email.getTo());
+ return "SENT";
+ }
+
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/resources/META-INF/sca-contribution.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..cd9f3c864c
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="scatours.emailgateway"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/resources/emailgateway.composite b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/resources/emailgateway.composite
new file mode 100644
index 0000000000..5daf27a61d
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/emailgateway-contribution/src/test/resources/emailgateway.composite
@@ -0,0 +1,37 @@
+<?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"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:c="http://creditcard"
+ targetNamespace="http://creditcard"
+ name="emailgateway">
+ <component name="EmailGatewayClient">
+ <implementation.java class="scatours.emailgateway.client.EmailGatewayClientImpl" />
+ <reference name="emailGateway">
+ <binding.ws uri="http://localhost:8082/EmailGateway" />
+ </reference>
+ </component>
+ <component name="EmailGateway">
+ <implementation.java class="scatours.emailgateway.EmailGatewayImpl" />
+ <service name="EmailGateway">
+ <binding.ws uri="http://localhost:8082/EmailGateway" />
+ </service>
+ </component>
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/flight-contribution/pom.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/flight-contribution/pom.xml
new file mode 100644
index 0000000000..2bd543e5ab
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/flight-contribution/pom.xml
@@ -0,0 +1,62 @@
+<?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.6-SNAPSHOT</version>
+ <!--relativePath>../../pom.xml</relativePath-->
+ </parent>
+ <artifactId>scatours-flight-contribution</artifactId>
+ <name>Apache Tuscany SCA Tours Flight Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-data-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-common-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/flight-contribution/src/main/java/scatours/flight/FlightImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/flight-contribution/src/main/java/scatours/flight/FlightImpl.java
new file mode 100644
index 0000000000..72c1c7201c
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/flight-contribution/src/main/java/scatours/flight/FlightImpl.java
@@ -0,0 +1,127 @@
+/*
+ * 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 scatours.flight;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import scatours.common.Book;
+import scatours.common.Search;
+import scatours.common.SearchCallback;
+import scatours.common.TripItem;
+import scatours.common.TripLeg;
+
+/**
+ * An implementation of the Hotel service
+ */
+@Scope("STATELESS")
+@Service(interfaces={Search.class, Book.class})
+public class FlightImpl implements Search, Book {
+
+ private List<FlightInfo> flights = new ArrayList<FlightInfo>();
+
+ @Callback
+ protected SearchCallback searchCallback;
+
+ @Init
+ public void init() {
+ flights.add(new FlightInfo("EA26",
+ "Europe Airlines Airbus A300",
+ "LGW",
+ "FLR",
+ "06/12/09",
+ "06/12/09",
+ "350",
+ 250,
+ "EUR",
+ "http://localhost:8085/tbd" ));
+ flights.add(new FlightInfo("EA27",
+ "Europe Airlines Airbus A300",
+ "FLR",
+ "LGW",
+ "13/12/09",
+ "13/12/09",
+ "350",
+ 250,
+ "EUR",
+ "http://localhost:8085/tbd" ));
+
+ }
+
+ public TripItem[] searchSynch(TripLeg tripLeg) {
+ List<TripItem> items = new ArrayList<TripItem>();
+
+ // find outbound leg
+ for(FlightInfo flight : flights){
+ if ((flight.getFromLocation().equals(tripLeg.getFromLocation())) &&
+ (flight.getToLocation().equals(tripLeg.getToLocation())) &&
+ (flight.getFromDate().equals(tripLeg.getFromDate()))){
+ TripItem item = new TripItem("",
+ "",
+ TripItem.FLIGHT,
+ flight.getName(),
+ flight.getDescription(),
+ flight.getFromLocation() + " - " + flight.getToLocation(),
+ flight.getFromDate(),
+ flight.getToDate(),
+ flight.getPricePerSeat(),
+ flight.getCurrency(),
+ flight.getLink());
+ items.add(item);
+ }
+ }
+
+ // find return leg
+ for(FlightInfo flight : flights){
+ if ((flight.getFromLocation().equals(tripLeg.getToLocation())) &&
+ (flight.getToLocation().equals(tripLeg.getFromLocation())) &&
+ (flight.getFromDate().equals(tripLeg.getToDate()))){
+ TripItem item = new TripItem("",
+ "",
+ TripItem.FLIGHT,
+ flight.getName(),
+ flight.getDescription(),
+ flight.getFromLocation() + " - " + flight.getToLocation(),
+ flight.getFromDate(),
+ tripLeg.getToDate(),
+ flight.getPricePerSeat(),
+ flight.getCurrency(),
+ flight.getLink());
+ items.add(item);
+ }
+ }
+
+ return items.toArray(new TripItem[items.size()]);
+ }
+
+ public void searchAsynch(TripLeg tripLeg) {
+
+ // return available hotels
+ searchCallback.searchResults(searchSynch(tripLeg));
+ }
+
+ public String book(TripItem tripItem) {
+ return "flight1";
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/flight-contribution/src/main/java/scatours/flight/FlightInfo.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/flight-contribution/src/main/java/scatours/flight/FlightInfo.java
new file mode 100644
index 0000000000..fb5fb9fef5
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/flight-contribution/src/main/java/scatours/flight/FlightInfo.java
@@ -0,0 +1,142 @@
+/*
+ * 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 scatours.flight;
+
+
+public class FlightInfo {
+
+ private String name;
+ private String description;
+ private String fromLocation;
+ private String toLocation;
+ private String fromDate;
+ private String toDate;
+ private String seats;
+ private double pricePerSeat;
+ private String currency;
+ private String link;
+
+ public FlightInfo() {
+ }
+
+ public FlightInfo(String name,
+ String description,
+ String fromLocation,
+ String toLocation,
+ String fromDate,
+ String toDate,
+ String seats,
+ double pricePerSeat,
+ String currency,
+ String link) {
+
+
+ this.name = name;
+ this.description = description;
+ this.fromLocation = fromLocation;
+ this.toLocation = toLocation;
+ this.fromDate = fromDate;
+ this.toDate = toDate;
+ this.seats = seats;
+ this.pricePerSeat = pricePerSeat;
+ this.currency = currency;
+ this.link = link;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getFromLocation() {
+ return fromLocation;
+ }
+
+ public void setFromLocation(String fromLocation) {
+ this.fromLocation = fromLocation;
+ }
+
+ public String getToLocation() {
+ return toLocation;
+ }
+
+ public void setToLocation(String toLocation) {
+ this.toLocation = toLocation;
+ }
+
+ public String getFromDate() {
+ return fromDate;
+ }
+
+ public void setFromDate(String fromDate) {
+ this.fromDate = fromDate;
+ }
+
+ public String getToDate() {
+ return toDate;
+ }
+
+ public void setToDate(String toDate) {
+ this.toDate = toDate;
+ }
+
+ public String getSeats() {
+ return seats;
+ }
+
+ public void setSeats(String seats) {
+ this.seats = seats;
+ }
+
+ public double getPricePerSeat() {
+ return pricePerSeat;
+ }
+
+ public void setPricePerSeat(double pricePerSeat) {
+ this.pricePerSeat = pricePerSeat;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/flight-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/flight-contribution/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..394be817a9
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/flight-contribution/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="scatours.common"/>
+ <export.java package="scatours.flight"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/hotel-contribution/pom.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/hotel-contribution/pom.xml
new file mode 100644
index 0000000000..7e2f764dad
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/hotel-contribution/pom.xml
@@ -0,0 +1,62 @@
+<?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.6-SNAPSHOT</version>
+ <!--relativePath>../../pom.xml</relativePath-->
+ </parent>
+ <artifactId>scatours-hotel-contribution</artifactId>
+ <name>Apache Tuscany SCA Tours Hotel Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-data-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-common-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/hotel-contribution/src/main/java/scatours/hotel/HotelImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/hotel-contribution/src/main/java/scatours/hotel/HotelImpl.java
new file mode 100644
index 0000000000..a9a6d1bbde
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/hotel-contribution/src/main/java/scatours/hotel/HotelImpl.java
@@ -0,0 +1,116 @@
+/*
+ * 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 scatours.hotel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import scatours.common.Book;
+import scatours.common.Search;
+import scatours.common.SearchCallback;
+import scatours.common.TripItem;
+import scatours.common.TripLeg;
+
+/**
+ * An implementation of the Hotel service
+ */
+@Scope("STATELESS")
+@Service(interfaces={Search.class, Book.class})
+public class HotelImpl implements Search, Book {
+
+ private List<HotelInfo> hotels = new ArrayList<HotelInfo>();
+
+ @Callback
+ protected SearchCallback searchCallback;
+
+ @Init
+ public void init() {
+ hotels.add(new HotelInfo("Deep Bay Hotel",
+ "Wonderful sea views and a relaxed atmosphere",
+ "FLR",
+ "06/12/09",
+ "200",
+ 100,
+ "EUR",
+ "http://localhost:8085/tbd" ));
+ hotels.add(new HotelInfo("Long Bay Hotel",
+ "Friendly staff and an ocean breeze",
+ "FLR",
+ "06/12/09",
+ "200",
+ 100,
+ "EUR",
+ "http://localhost:8085/tbd" ));
+ hotels.add(new HotelInfo("City Hotel",
+ "Smart rooms and early breakfasts",
+ "FLR",
+ "06/12/09",
+ "200",
+ 100,
+ "EUR",
+ "http://localhost:8085/tbd" ));
+ hotels.add(new HotelInfo("County Hotel",
+ "The smell of the open country",
+ "FLR",
+ "06/12/09",
+ "200",
+ 100,
+ "EUR",
+ "http://localhost:8085/tbd" ));
+ }
+
+ public TripItem[] searchSynch(TripLeg tripLeg) {
+ List<TripItem> items = new ArrayList<TripItem>();
+
+ // find available hotels
+ for(HotelInfo hotel : hotels){
+ if (hotel.getLocation().equals(tripLeg.getToLocation())){
+ TripItem item = new TripItem("",
+ "",
+ TripItem.HOTEL,
+ hotel.getName(),
+ hotel.getDescription(),
+ hotel.getLocation(),
+ tripLeg.getFromDate(),
+ tripLeg.getToDate(),
+ hotel.getPricePerBed(),
+ hotel.getCurrency(),
+ hotel.getLink());
+ items.add(item);
+ }
+ }
+
+ return items.toArray(new TripItem[items.size()]);
+ }
+
+ public void searchAsynch(TripLeg tripLeg) {
+
+ // return available hotels
+ searchCallback.searchResults(searchSynch(tripLeg));
+ }
+
+ public String book(TripItem tripItem) {
+ return "hotel1";
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/hotel-contribution/src/main/java/scatours/hotel/HotelInfo.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/hotel-contribution/src/main/java/scatours/hotel/HotelInfo.java
new file mode 100644
index 0000000000..3b0d11d16e
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/hotel-contribution/src/main/java/scatours/hotel/HotelInfo.java
@@ -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.
+ */
+
+package scatours.hotel;
+
+
+public class HotelInfo {
+
+ private String name;
+ private String description;
+ private String location;
+ private String date;
+ private String beds;
+ private double pricePerBed;
+ private String currency;
+ private String link;
+
+ public HotelInfo() {
+ }
+
+ public HotelInfo(String name,
+ String description,
+ String location,
+ String date,
+ String beds,
+ double pricePerBed,
+ String currency,
+ String link) {
+
+ this.name = name;
+ this.description = description;
+ this.location = location;
+ this.date = date;
+ this.beds = beds;
+ this.pricePerBed = pricePerBed;
+ this.currency = currency;
+ this.link = link;
+ }
+
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getDate() {
+ return date;
+ }
+
+ public void setDate(String date) {
+ this.date = date;
+ }
+
+ public String getBeds() {
+ return beds;
+ }
+
+ public void setBeds(String beds) {
+ this.beds = beds;
+ }
+
+ public double getPricePerBed() {
+ return pricePerBed;
+ }
+
+ public void setPricePerBed(double pricePerBed) {
+ this.pricePerBed = pricePerBed;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/hotel-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/hotel-contribution/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..765c8d1cc3
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/hotel-contribution/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="scatours.common"/>
+ <export.java package="scatours.hotel"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/pom.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/pom.xml
new file mode 100644
index 0000000000..aee48250d6
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/pom.xml
@@ -0,0 +1,155 @@
+<?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.6-SNAPSHOT</version>
+ <!--relativePath>../../pom.xml</relativePath-->
+ </parent>
+ <artifactId>scatours-payment-java-contribution</artifactId>
+ <name>Apache Tuscany SCA Tours Payment Java Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-security</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-transaction</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</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-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/jaxws-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <version>1.9</version>
+ <executions>
+ <execution>
+ <id>payment</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ <configuration>
+ <packageName>payment</packageName>
+ <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory>
+ <wsdlFiles>
+ <wsdlFile>Payment.wsdl</wsdlFile>
+ </wsdlFiles>
+ <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir>
+ <staleFile>${project.build.directory}/jaxws-source/stale/payment.stale</staleFile>
+ <verbose>false</verbose>
+ <xnocompile>true</xnocompile>
+ </configuration>
+ </execution>
+ <execution>
+ <id>payment.creditcard</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ <configuration>
+ <packageName>payment.creditcard</packageName>
+ <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory>
+ <wsdlFiles>
+ <wsdlFile>CreditCardPayment.wsdl</wsdlFile>
+ </wsdlFiles>
+ <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir>
+ <staleFile>${project.build.directory}/jaxws-source/stale/creditcard.stale</staleFile>
+ <verbose>false</verbose>
+ <xnocompile>true</xnocompile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/payment/PaymentImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/payment/PaymentImpl.java
new file mode 100644
index 0000000000..8c9777fdd4
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/payment/PaymentImpl.java
@@ -0,0 +1,88 @@
+/*
+ * 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 payment;
+
+import javax.annotation.security.RolesAllowed;
+import javax.annotation.security.RunAs;
+
+import org.osoa.sca.annotations.Authentication;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import payment.creditcard.AuthorizeFault_Exception;
+import payment.creditcard.CreditCardDetailsType;
+import payment.creditcard.CreditCardPayment;
+import scatours.customer.Customer;
+import scatours.customer.CustomerNotFoundException;
+import scatours.customer.CustomerRegistry;
+import scatours.emailgateway.EmailGateway;
+
+/**
+ * The payment implementation
+ */
+@Service(Payment.class)
+@RolesAllowed({"Admin", "Billing"})
+@RunAs("Billing")
+public class PaymentImpl implements Payment {
+
+ @Reference
+ protected CustomerRegistry customerRegistry;
+
+ @Reference
+ @Authentication
+ protected CreditCardPayment creditCardPayment;
+
+ @Reference
+ protected EmailGateway emailGateway;
+
+ @Property
+ protected float transactionFeeRate = 0.01f;
+
+ public String makePaymentMember(String customerId, float amount) {
+ Customer customer = null;
+
+ try {
+ customer = customerRegistry.getCustomer(customerId);
+ } catch (CustomerNotFoundException ex) {
+ return "Payment failed due to " + ex.getMessage();
+ } catch (Throwable t) {
+ return "Payment failed due to system error " + t.getMessage();
+ }
+
+ CreditCardDetailsType ccDetails = customer.getCreditCard();
+
+ String status;
+ try {
+ status = creditCardPayment.authorize(ccDetails, amount);
+ } catch (AuthorizeFault_Exception e) {
+ status = e.getFaultInfo().getErrorCode();
+ }
+
+ StringBuffer body = new StringBuffer();
+ body.append(customer);
+ body.append("\n").append("Status: ").append(status).append("\n");
+ emailGateway.sendEmail("order@tuscanyscatours.com", customer.getEmail(), "Status for your payment", body
+ .toString());
+
+ return status;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/payment/creditcard/CreditCardPaymentImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/payment/creditcard/CreditCardPaymentImpl.java
new file mode 100644
index 0000000000..02918efb6c
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/payment/creditcard/CreditCardPaymentImpl.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 payment.creditcard;
+
+import javax.annotation.security.RolesAllowed;
+
+import org.osoa.sca.annotations.Requires;
+import org.osoa.sca.annotations.Service;
+
+@Service(CreditCardPayment.class)
+@Requires("{http://www.osoa.org/xmlns/sca/1.0}authorization")
+@RolesAllowed("Admin")
+public class CreditCardPaymentImpl implements CreditCardPayment {
+
+ public String authorize(CreditCardDetailsType creditCard, float amount) throws AuthorizeFault_Exception {
+ if (creditCard != null) {
+ System.out.println("Checking card: name = " + creditCard.getCardOwner().getName()
+ + " number = "
+ + creditCard.getCreditCardNumber()
+ + " for amount "
+ + amount);
+ } else {
+ System.out.println("Checking card is null");
+ ObjectFactory factory = new ObjectFactory();
+ AuthorizeFault fault = factory.createAuthorizeFault();
+ fault.setErrorCode("001 - Invalid card");
+ AuthorizeFault_Exception ex = new AuthorizeFault_Exception("Invalid card", fault);
+ throw ex;
+ }
+
+ return "OK";
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/customer/Customer.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/customer/Customer.java
new file mode 100644
index 0000000000..f80a691d96
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/customer/Customer.java
@@ -0,0 +1,70 @@
+/*
+ * 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 scatours.customer;
+
+import payment.creditcard.CreditCardDetailsType;
+
+/**
+ * Customer data
+ */
+public class Customer {
+ private String id;
+ private String email;
+ private String name;
+
+ private CreditCardDetailsType creditCard;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public CreditCardDetailsType getCreditCard() {
+ return creditCard;
+ }
+
+ public void setCreditCard(CreditCardDetailsType creditCard) {
+ this.creditCard = creditCard;
+ }
+
+ public String toString() {
+ return "id: " + id + " name: " + name + " e-mail: " + email;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/customer/CustomerNotFoundException.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/customer/CustomerNotFoundException.java
new file mode 100644
index 0000000000..ebfb104650
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/customer/CustomerNotFoundException.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours.customer;
+
+
+public class CustomerNotFoundException extends Exception {
+ private static final long serialVersionUID = -129752837478357452L;
+
+ /**
+ *
+ */
+ public CustomerNotFoundException() {
+
+ }
+
+ /**
+ * @param message
+ */
+ public CustomerNotFoundException(String message) {
+ super(message);
+
+ }
+
+ /**
+ * @param cause
+ */
+ public CustomerNotFoundException(Throwable cause) {
+ super(cause);
+
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public CustomerNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+
+ }
+
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/customer/CustomerRegistry.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/customer/CustomerRegistry.java
new file mode 100644
index 0000000000..c7c9f11a6c
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/customer/CustomerRegistry.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 scatours.customer;
+
+import java.util.Collection;
+
+import payment.creditcard.CreditCardDetailsType;
+
+/**
+ * Customer registry interface
+ */
+public interface CustomerRegistry {
+ Customer createCustomer(String name, String email, CreditCardDetailsType creditCard);
+
+ boolean updateCustomer(Customer customer);
+
+ Customer getCustomer(String id) throws CustomerNotFoundException;
+
+ Collection<Customer> getAllCustomers();
+
+ boolean deleteCustomer(String id);
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/customer/CustomerRegistryImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/customer/CustomerRegistryImpl.java
new file mode 100644
index 0000000000..615f0ef1b9
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/customer/CustomerRegistryImpl.java
@@ -0,0 +1,112 @@
+/*
+ * 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 scatours.customer;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Requires;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import payment.creditcard.CreditCardDetailsType;
+import payment.creditcard.CreditCardTypeType;
+import payment.creditcard.ObjectFactory;
+import payment.creditcard.PayerType;
+
+/**
+ * An in-memory customer registry implementation
+ */
+@Service(CustomerRegistry.class)
+@Scope("COMPOSITE")
+@EagerInit
+@Requires("{http://www.osoa.org/xmlns/sca/1.0}managedTransaction.global")
+public class CustomerRegistryImpl implements CustomerRegistry {
+ private volatile static int idGenerator = 0;
+ private Map<String, Customer> customers = new HashMap<String, Customer>();
+
+ @Init
+ public void init() {
+ // Load the customers
+ ObjectFactory factory = new ObjectFactory();
+ CreditCardDetailsType cc = factory.createCreditCardDetailsType();
+ PayerType john = factory.createPayerType();
+ john.setName("John Smith");
+ cc.setCardOwner(john);
+ cc.setCreditCardNumber("1111-2222-3333-4444");
+ cc.setCreditCardType(CreditCardTypeType.VISA);
+ cc.setCVV2("1234");
+ cc.setExpMonth(1);
+ cc.setExpYear(2012);
+ createCustomer("John Smith", "john@xyz.com", cc);
+ }
+
+ @Destroy
+ public void destroy() {
+ // Save the customers
+ }
+
+ public Customer createCustomer(String name, String email, CreditCardDetailsType creditCard) {
+ Customer customer = new Customer();
+ customer.setId("c-" + idGenerator++);
+ customer.setName(name);
+ customer.setEmail(email);
+ customer.setCreditCard(creditCard);
+ customers.put(customer.getId(), customer);
+ return customer;
+ }
+
+ public boolean deleteCustomer(String id) {
+ return customers.remove(id) != null;
+ }
+
+ public Collection<Customer> getAllCustomers() {
+ return customers.values();
+ }
+
+ public Customer getCustomer(String id) throws CustomerNotFoundException {
+ Customer customer = customers.get(id);
+
+ if (customer == null){
+ throw new CustomerNotFoundException("Customer " + id + " not found");
+ }
+
+ return customer;
+ }
+
+ public boolean updateCustomer(Customer customer) {
+ Customer current = null;
+ try {
+ current = getCustomer(customer.getId());
+ } catch (Exception ex) {
+ return false;
+ }
+
+ current.setEmail(customer.getEmail());
+ current.setName(customer.getName());
+ current.setCreditCard(customer.getCreditCard());
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/emailgateway/EmailGateway.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/emailgateway/EmailGateway.java
new file mode 100644
index 0000000000..6c3662b265
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/emailgateway/EmailGateway.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 scatours.emailgateway;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * A gateway to send e-mail
+ */
+@Remotable
+public interface EmailGateway {
+ public boolean sendEmail(String sender, String recipient, String subject, String body);
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/emailgateway/EmailGatewayImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/emailgateway/EmailGatewayImpl.java
new file mode 100644
index 0000000000..b5a5debd38
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/java/scatours/emailgateway/EmailGatewayImpl.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours.emailgateway;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(EmailGateway.class)
+public class EmailGatewayImpl implements EmailGateway {
+
+ public boolean sendEmail(String sender, String recipient, String subject, String body) {
+ System.out.println("From: " + sender);
+ System.out.println("To: " + recipient);
+ System.out.println("Subject: " + subject);
+ System.out.println(body);
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/CreditCardPayment.wsdl
new file mode 100644
index 0000000000..7d30a6a395
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/CreditCardPayment.wsdl
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions name="CreditCardPayment"
+ targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/">
+
+ <xsd:element name="authorize" type="tns:AuthorizeType"/>
+ <xsd:complexType name="AuthorizeType">
+ <xsd:sequence>
+ <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element>
+ <xsd:element name="Amount" type="xsd:float"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="authorizeResponse" type="tns:AuthorizeResponseType"/>
+ <xsd:complexType name="AuthorizeResponseType">
+ <xsd:sequence>
+ <xsd:element name="Status" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="CreditCardDetailsType">
+ <xsd:sequence>
+ <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" />
+ <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" />
+ <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" />
+ <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" />
+ <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" />
+ <xsd:element name="CVV2" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:simpleType name="CreditCardTypeType">
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="Visa" />
+ <xsd:enumeration value="MasterCard" />
+ <xsd:enumeration value="Discover" />
+ <xsd:enumeration value="Amex" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="PayerType">
+ <xsd:sequence>
+ <xsd:element name="Name" type="xsd:string" />
+ <xsd:element name="Address" type="tns:AddressType" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AddressType">
+ <xsd:sequence>
+ <xsd:element name="Street" type="xsd:string" />
+ <xsd:element name="City" type="xsd:string" />
+ <xsd:element name="State" type="xsd:string" />
+ <xsd:element name="ZipCode" type="xsd:string" />
+ <xsd:element name="HomePhone" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="authorizeFault">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="errorCode" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="AuthorizeRequest">
+ <wsdl:part name="parameters" element="tns:authorize"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="AuthorizeResponse">
+ <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="AuthorizeFault">
+ <wsdl:part name="parameters" element="tns:authorizeFault"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="CreditCardPayment">
+ <wsdl:operation name="authorize">
+ <wsdl:input message="tns:AuthorizeRequest"></wsdl:input>
+ <wsdl:output message="tns:AuthorizeResponse"></wsdl:output>
+ <wsdl:fault name="authorizationFailure" message="tns:AuthorizeFault"></wsdl:fault>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="authorize">
+ <soap:operation soapAction="http://www.tuscanyscatours.com/CreditCardPayment/authorize" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ <wsdl:fault name="authorizationFailure">
+ <soap:fault name="authorizationFailure" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CreditCardPaymentService">
+ <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding">
+ <soap:address location="http://localhost:8080/CreditCardPayment" />
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="CreditCardPaymentLinkType">
+ <plnk:role name="forward" portType="tns:CreditCardPayment"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..7adba24d58
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <export.java package="payment"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/Payment.wsdl b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/Payment.wsdl
new file mode 100644
index 0000000000..2519d7642e
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/Payment.wsdl
@@ -0,0 +1,83 @@
+<?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 name="Payment"
+ targetNamespace="http://www.tuscanyscatours.com/Payment/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://www.tuscanyscatours.com/Payment/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.tuscanyscatours.com/Payment/"
+ xmlns:tns="http://www.tuscanyscatours.com/Payment/">
+
+ <xsd:complexType name="MakePaymentMemberType">
+ <xsd:sequence>
+ <xsd:element name="CustomerId" type="xsd:string"></xsd:element>
+ <xsd:element name="Amount" type="xsd:float"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="makePaymentMember" type="tns:MakePaymentMemberType"/>
+
+ <xsd:complexType name="MakePaymentMemberResponseType">
+ <xsd:sequence>
+ <xsd:element name="Status" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="makePaymentMemberResponse" type="tns:MakePaymentMemberResponseType"/>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="MakePaymentMemberRequest">
+ <wsdl:part name="parameters" element="tns:makePaymentMember"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="MakePaymentMemberResponse">
+ <wsdl:part name="parameters" element="tns:makePaymentMemberResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="Payment">
+ <wsdl:operation name="makePaymentMember">
+ <wsdl:input message="tns:MakePaymentMemberRequest"></wsdl:input>
+ <wsdl:output message="tns:MakePaymentMemberResponse"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="PaymentBinding" type="tns:Payment">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="makePaymentMember">
+ <soap:operation soapAction="http://www.tuscanyscatours.com/Payment/makePayment" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="PaymentService">
+ <wsdl:port name="PaymentPort" binding="tns:PaymentBinding">
+ <soap:address location="http://localhost:8083/Payment" />
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="PaymentLinkType">
+ <plnk:role name="forward" portType="tns:Payment"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/definitions.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..475d923506
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/definitions.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <!-- Policy Intents Defined by the SCA Runtime -->
+ <intent name="authorization" constrains="sca:implementation"/>
+
+ <!-- Policy intents -->
+ <policySet name="ps1" provides="sca:authorization" appliesTo="sca:implementation.java"/>
+
+ <policySet name="ps2" provides="sca:managedTransaction.global" appliesTo="sca:implementation.java"/>
+
+</definitions>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/payment.composite b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/payment.composite
new file mode 100644
index 0000000000..00ea330e79
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/main/resources/payment.composite
@@ -0,0 +1,46 @@
+<?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://scatours"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:c="http://scatours"
+ name="payment">
+
+ <component name="PaymentComponent">
+ <implementation.java class="payment.PaymentImpl" />
+ <reference name="customerRegistry" target="CustomerRegistryComponent"/>
+ <reference name="creditCardPayment" target="CreditCardPaymentComponent"/>
+ <reference name="emailGateway" target="EmailGatewayComponent"/>
+ <property name="transactionFeeRate">0.02</property>
+ </component>
+
+ <component name="CustomerRegistryComponent">
+ <implementation.java class="scatours.customer.CustomerRegistryImpl" />
+ </component>
+
+ <component name="EmailGatewayComponent">
+ <implementation.java class="scatours.emailgateway.EmailGatewayImpl" />
+ </component>
+
+ <component name="CreditCardPaymentComponent">
+ <implementation.java class="payment.creditcard.CreditCardPaymentImpl" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/test/java/payment/PaymentTestCase.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/test/java/payment/PaymentTestCase.java
new file mode 100644
index 0000000000..d88764cfac
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/payment-java-contribution/src/test/java/payment/PaymentTestCase.java
@@ -0,0 +1,77 @@
+/*
+ * 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 payment;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class PaymentTestCase {
+ private static SCANode node;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ SCANodeFactory factory = SCANodeFactory.newInstance();
+ node = factory.createSCANodeFromClassLoader("payment.composite", Payment.class.getClassLoader());
+ node.start();
+ }
+
+ @Test
+ public void testCreditCardPayment() {
+ SCAClient client = (SCAClient) node;
+ Payment payment = client.getService(Payment.class, "PaymentComponent");
+ System.out.println(payment.makePaymentMember("c-0", 100.00f));
+ System.out.println(payment.makePaymentMember("c-1", 100.00f));
+ }
+
+ @Test
+ //@Ignore
+ public void testWaitForInput() {
+/*
+ System.out.println("Press a key to end");
+ try {
+ System.in.read();
+ } catch (Exception ex) {
+ }
+ System.out.println("Shutting down");
+*/
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ if (node != null) {
+ node.stop();
+ node = null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/pom.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/pom.xml
new file mode 100644
index 0000000000..dec2e0b4a1
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/pom.xml
@@ -0,0 +1,58 @@
+<?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.5-SNAPSHOT</version>
+ <!--relativePath>../pom.xml</relativePath-->
+ </parent>
+ <artifactId>tuscany-scatours-common-contributions</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Tours Common Contributions</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>calendar-contribution</module>
+ <module>car-contribution</module>
+ <module>common-contribution</module>
+ <module>creditcard-payment-jaxb-contribution</module>
+ <module>currency-contribution</module>
+ <module>emailgateway-contribution</module>
+ <module>flight-contribution</module>
+ <module>hotel-contribution</module>
+ <module>shoppingcart-contribution</module>
+ <module>travelcatalog-contribution</module>
+ <module>tripbooking-contribution</module>
+ <module>trip-contribution</module>
+ <module>scatours-contribution</module>
+ <module>payment-java-contribution</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/pom.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/pom.xml
new file mode 100644
index 0000000000..f56eab078f
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/pom.xml
@@ -0,0 +1,94 @@
+<?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.6-SNAPSHOT</version>
+ <!--relativePath>../../pom.xml</relativePath-->
+ </parent>
+ <artifactId>scatours-scatours-contribution</artifactId>
+ <name>Apache Tuscany SCA Tours SCATours Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-data-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-common-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-currency-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-travelcatalog-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-tripbooking-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-shoppingcart-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <!--
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-paymentprocess-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+ -->
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursBooking.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursBooking.java
new file mode 100644
index 0000000000..ac39443e9c
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursBooking.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 scatours;
+
+
+import org.osoa.sca.annotations.Remotable;
+
+import scatours.common.TripItem;
+
+/**
+ * The SCA Tours trip booking service interface
+ */
+@Remotable
+public interface SCAToursBooking {
+ String bookTrip(String cartId, TripItem tripId);
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursCart.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursCart.java
new file mode 100644
index 0000000000..74755f5e32
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursCart.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+import scatours.common.TripItem;
+
+/**
+ * The ShoppingCart service interface
+ */
+@Remotable
+public interface SCAToursCart{
+ String newCart();
+ TripItem[] getTrips(String cartId);
+ void checkout(String cartId);
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursImpl.java
new file mode 100644
index 0000000000..e38be75af7
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursImpl.java
@@ -0,0 +1,99 @@
+/*
+ * 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 scatours;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import scatours.common.TripItem;
+import scatours.common.TripLeg;
+import scatours.shoppingcart.ShoppingCart;
+import scatours.travelcatalog.TravelCatalogSearch;
+import scatours.tripbooking.TripBooking;
+
+/**
+ * An implementation of the SCA tours component. This component currently provides
+ * a front end to the components that the UI communicated with. It allows a conversation
+ * to be held with the shopping cart as javascript doesn't support conversations.
+ * Other than that it's just a pass through so we could look to remove it.
+ */
+@Scope("COMPOSITE")
+@Service(interfaces={SCAToursSearch.class, SCAToursBooking.class, SCAToursCart.class})
+public class SCAToursImpl implements SCAToursSearch, SCAToursBooking, SCAToursCart{
+
+ @Reference
+ protected TravelCatalogSearch travelCatalogSearch;
+
+ @Reference
+ protected TripBooking tripBooking;
+
+ @Reference
+ protected ShoppingCart shoppingCart;
+
+ @Context
+ protected ComponentContext componentContext;
+
+ private Map<String,ShoppingCart> carts = new HashMap<String,ShoppingCart>();
+ private Map<String,TripBooking> trips = new HashMap<String,TripBooking>();
+
+ // SCAToursSearch methods
+
+ public TripItem[] search(TripLeg tripLeg) {
+
+ return travelCatalogSearch.search(tripLeg);
+
+ }
+
+ // SCAToursBooking methods
+
+ public String bookTrip(String cartId, TripItem trip){
+ TripItem bookedTrip = tripBooking.bookTrip(cartId, trip);
+ carts.get(cartId).addTrip(bookedTrip);
+ return bookedTrip.getBookingCode();
+ }
+
+ // SCAToursCart methods
+
+ public String newCart(){
+ String cartId = UUID.randomUUID().toString();
+ ServiceReference<ShoppingCart> shoppingCart = componentContext.getServiceReference(ShoppingCart.class,
+ "shoppingCart");
+ shoppingCart.setConversationID(cartId);
+ carts.put(cartId, shoppingCart.getService());
+
+ return cartId;
+ }
+
+ public TripItem[] getTrips(String cartId){
+ return carts.get(cartId).getTrips();
+ }
+
+ public void checkout(String cartId){
+ // need to get the user id from the context here
+ carts.get(cartId).checkout("Fred");
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursSearch.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursSearch.java
new file mode 100644
index 0000000000..f0f435fc06
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursSearch.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 scatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+import scatours.common.TripItem;
+import scatours.common.TripLeg;
+
+/**
+ * The Trip service interface
+ */
+@Remotable
+public interface SCAToursSearch {
+ TripItem[] search(TripLeg tripLeg);
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..368e95ebd0
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/scatours-contribution/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,26 @@
+<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="scatours.common"/>
+ <import.java package="scatours.travelcatalog"/>
+ <import.java package="scatours.tripbooking"/>
+ <import.java package="scatours.shoppingcart"/>
+ <export.java package="scatours"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/pom.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/pom.xml
new file mode 100644
index 0000000000..610471b9f2
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/pom.xml
@@ -0,0 +1,119 @@
+<?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.6-SNAPSHOT</version>
+ <!--relativePath>../../pom.xml</relativePath-->
+ </parent>
+ <artifactId>scatours-shoppingcart-contribution</artifactId>
+ <name>Apache Tuscany SCA Tours Shopping Cart Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-data-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-common-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-currency-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-payment-java-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</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-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/jaxws-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <version>1.9</version>
+ <executions>
+ <execution>
+ <id>payment</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ <configuration>
+ <packageName>payment</packageName>
+ <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory>
+ <wsdlFiles>
+ <wsdlFile>Payment.wsdl</wsdlFile>
+ </wsdlFiles>
+ <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir>
+ <verbose>false</verbose>
+ <xnocompile>true</xnocompile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/src/main/java/scatours/shoppingcart/ShoppingCart.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/src/main/java/scatours/shoppingcart/ShoppingCart.java
new file mode 100644
index 0000000000..f7595c71fe
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/src/main/java/scatours/shoppingcart/ShoppingCart.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 scatours.shoppingcart;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+import scatours.common.TripItem;
+
+/**
+ * The ShoppingCart service interface
+ */
+@Remotable
+@Conversational
+public interface ShoppingCart{
+ void addTrip(TripItem trip);
+ void removeTrip(TripItem trip);
+ TripItem[] getTrips();
+
+ @EndsConversation
+ void checkout(String name);
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/src/main/java/scatours/shoppingcart/ShoppingCartImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/src/main/java/scatours/shoppingcart/ShoppingCartImpl.java
new file mode 100644
index 0000000000..5021f62715
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/src/main/java/scatours/shoppingcart/ShoppingCartImpl.java
@@ -0,0 +1,95 @@
+/*
+ * 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 scatours.shoppingcart;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import payment.Payment;
+import scatours.common.TripItem;
+
+/**
+ * An implementation of the Trip service
+ */
+@Scope("CONVERSATION")
+@Service(interfaces={ShoppingCart.class})
+public class ShoppingCartImpl implements ShoppingCart{
+
+ @Reference
+ protected Payment payment;
+
+ @ConversationID
+ protected String cartId;
+
+ private List<TripItem> trips = new ArrayList<TripItem>();
+
+ // Trip methods
+
+ @Init
+ public void initCart() {
+ System.out.println("Cart init for id: " + cartId);
+ }
+
+ @Destroy
+ public void destroyCart() {
+ System.out.println("Cart destroy for id: " + cartId);
+ }
+
+ public void addTrip(TripItem trip) {
+ trips.add(trip);
+ }
+
+ public void removeTrip(TripItem trip) {
+ trips.remove(trip);
+ }
+
+ public TripItem[] getTrips(){
+ return trips.toArray(new TripItem[trips.size()]);
+ }
+
+ public void checkout(String customerName){
+ // get users credentials. Hard coded for now but should
+ // come from the security context
+ String customerId = customerName;
+
+ // get the total for all the trips
+ float amount = (float)0.0;
+
+ for (TripItem trip : trips){
+ if (trip.getType().equals(TripItem.TRIP)){
+ amount += trip.getPrice();
+ } else {
+ for (TripItem tripItem : trip.getTripItems()){
+ amount += tripItem.getPrice();
+ }
+ }
+ }
+
+ // Take the payment from the customer
+ payment.makePaymentMember(customerId, amount);
+ }
+
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..f4010d04b1
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="scatours.common"/>
+ <import.java package="scatours.paymentprocess"/>
+ <export.java package="scatours.shoppingcart"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/src/main/resources/Payment.wsdl b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/src/main/resources/Payment.wsdl
new file mode 100644
index 0000000000..2519d7642e
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/shoppingcart-contribution/src/main/resources/Payment.wsdl
@@ -0,0 +1,83 @@
+<?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 name="Payment"
+ targetNamespace="http://www.tuscanyscatours.com/Payment/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://www.tuscanyscatours.com/Payment/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.tuscanyscatours.com/Payment/"
+ xmlns:tns="http://www.tuscanyscatours.com/Payment/">
+
+ <xsd:complexType name="MakePaymentMemberType">
+ <xsd:sequence>
+ <xsd:element name="CustomerId" type="xsd:string"></xsd:element>
+ <xsd:element name="Amount" type="xsd:float"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="makePaymentMember" type="tns:MakePaymentMemberType"/>
+
+ <xsd:complexType name="MakePaymentMemberResponseType">
+ <xsd:sequence>
+ <xsd:element name="Status" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="makePaymentMemberResponse" type="tns:MakePaymentMemberResponseType"/>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="MakePaymentMemberRequest">
+ <wsdl:part name="parameters" element="tns:makePaymentMember"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="MakePaymentMemberResponse">
+ <wsdl:part name="parameters" element="tns:makePaymentMemberResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="Payment">
+ <wsdl:operation name="makePaymentMember">
+ <wsdl:input message="tns:MakePaymentMemberRequest"></wsdl:input>
+ <wsdl:output message="tns:MakePaymentMemberResponse"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="PaymentBinding" type="tns:Payment">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="makePaymentMember">
+ <soap:operation soapAction="http://www.tuscanyscatours.com/Payment/makePayment" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="PaymentService">
+ <wsdl:port name="PaymentPort" binding="tns:PaymentBinding">
+ <soap:address location="http://localhost:8083/Payment" />
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="PaymentLinkType">
+ <plnk:role name="forward" portType="tns:Payment"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/travelcatalog-contribution/pom.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/travelcatalog-contribution/pom.xml
new file mode 100644
index 0000000000..34beb37b5c
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/travelcatalog-contribution/pom.xml
@@ -0,0 +1,74 @@
+<?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.6-SNAPSHOT</version>
+ <!--relativePath>../../pom.xml</relativePath-->
+ </parent>
+ <artifactId>scatours-travelcatalog-contribution</artifactId>
+ <name>Apache Tuscany SCA Tours Travel Catalog Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-data-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-common-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-currency-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-tripbooking-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/travelcatalog-contribution/src/main/java/scatours/travelcatalog/TravelCatalogImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/travelcatalog-contribution/src/main/java/scatours/travelcatalog/TravelCatalogImpl.java
new file mode 100644
index 0000000000..4ad2c80c8f
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/travelcatalog-contribution/src/main/java/scatours/travelcatalog/TravelCatalogImpl.java
@@ -0,0 +1,132 @@
+/*
+ * 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 scatours.travelcatalog;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import scatours.common.Search;
+import scatours.common.SearchCallback;
+import scatours.common.TripItem;
+import scatours.common.TripLeg;
+import scatours.currencyconverter.CurrencyConverter;
+
+/**
+ * An implementation of the Trip service
+ */
+@Scope("COMPOSITE")
+@Service(interfaces={TravelCatalogSearch.class})
+public class TravelCatalogImpl implements TravelCatalogSearch, SearchCallback{
+
+ @Reference
+ protected Search hotelSearch;
+
+ @Reference
+ protected Search flightSearch;
+
+ @Reference
+ protected Search carSearch;
+
+ @Reference
+ protected Search tripSearch;
+
+ @Property
+ public String quoteCurrencyCode = "USD";
+
+ @Reference
+ protected CurrencyConverter currencyConverter;
+
+ @Context
+ protected ComponentContext componentContext;
+
+ private int responsesReceived = 0;
+
+ private List<TripItem> searchResults = new ArrayList<TripItem>();
+
+ // TravelSearch methods
+
+ public TripItem[] search(TripLeg tripLeg) {
+
+ searchResults.clear();
+ responsesReceived = 0;
+
+ ServiceReference<Search> dynamicHotelSearch =
+ componentContext.getServiceReference(Search.class, "hotelSearch");
+
+ dynamicHotelSearch.setCallbackID("HotelSearchCallbackID-" + tripLeg.getId());
+ dynamicHotelSearch.getService().searchAsynch(tripLeg);
+
+ flightSearch.searchAsynch(tripLeg);
+ carSearch.searchAsynch(tripLeg);
+ tripSearch.searchAsynch(tripLeg);
+
+ while (responsesReceived < 4){
+ try {
+ synchronized (this) {
+ this.wait();
+ }
+ } catch (InterruptedException ex){
+ // do nothing
+ }
+ }
+
+ for (TripItem tripItem : searchResults){
+ tripItem.setId(UUID.randomUUID().toString());
+ tripItem.setTripId(tripLeg.getId());
+ tripItem.setPrice(currencyConverter.convert(tripItem.getCurrency(),
+ quoteCurrencyCode,
+ tripItem.getPrice()));
+ tripItem.setCurrency(quoteCurrencyCode);
+ }
+
+ return searchResults.toArray(new TripItem[searchResults.size()]);
+ }
+
+ // SearchCallback methods
+
+ public void searchResults(TripItem[] items){
+ RequestContext requestContext = componentContext.getRequestContext();
+ Object callbackID = requestContext.getServiceReference().getCallbackID();
+ System.out.println(callbackID);
+
+ if (items != null) {
+ for(int i = 0; i < items.length; i++ ){
+ searchResults.add(items[i]);
+ }
+ }
+
+ responsesReceived++;
+ try {
+ synchronized (this) {
+ this.notifyAll();
+ }
+ } catch (Exception ex) {
+ }
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/travelcatalog-contribution/src/main/java/scatours/travelcatalog/TravelCatalogSearch.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/travelcatalog-contribution/src/main/java/scatours/travelcatalog/TravelCatalogSearch.java
new file mode 100644
index 0000000000..df22724de2
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/travelcatalog-contribution/src/main/java/scatours/travelcatalog/TravelCatalogSearch.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 scatours.travelcatalog;
+
+import org.osoa.sca.annotations.Remotable;
+
+import scatours.common.TripItem;
+import scatours.common.TripLeg;
+
+/**
+ * The Trip service interface
+ */
+@Remotable
+public interface TravelCatalogSearch {
+ TripItem[] search(TripLeg tripLeg);
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/travelcatalog-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/travelcatalog-contribution/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..286b9c2a05
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/travelcatalog-contribution/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="scatours.common"/>
+ <import.java package="scatours.currencyconverter"/>
+ <export.java package="scatours.travelcatalog"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/trip-contribution/pom.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/trip-contribution/pom.xml
new file mode 100644
index 0000000000..707ae97e5a
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/trip-contribution/pom.xml
@@ -0,0 +1,62 @@
+<?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.6-SNAPSHOT</version>
+ <!--relativePath>../../pom.xml</relativePath-->
+ </parent>
+ <artifactId>scatours-trip-contribution</artifactId>
+ <name>Apache Tuscany SCA Tours Prepackaged Trip Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-data-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-common-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/trip-contribution/src/main/java/scatours/trip/TripImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/trip-contribution/src/main/java/scatours/trip/TripImpl.java
new file mode 100644
index 0000000000..9d51c8078b
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/trip-contribution/src/main/java/scatours/trip/TripImpl.java
@@ -0,0 +1,106 @@
+/*
+ * 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 scatours.trip;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import scatours.common.Book;
+import scatours.common.Search;
+import scatours.common.SearchCallback;
+import scatours.common.TripItem;
+import scatours.common.TripLeg;
+
+/**
+ * An implementation of the Hotel service
+ */
+@Scope("STATELESS")
+@Service(interfaces={Search.class, Book.class})
+public class TripImpl implements Search, Book {
+
+ private List<TripInfo> trips = new ArrayList<TripInfo>();
+
+ @Callback
+ protected SearchCallback searchCallback;
+
+ @Init
+ public void init() {
+ trips.add(new TripInfo("FS1DEC06",
+ "Florence and Siena pre-packaged tour",
+ "LGW",
+ "FLR",
+ "06/12/09",
+ "13/12/09",
+ "27",
+ 450,
+ "EUR",
+ "http://localhost:8085/tbd" ));
+ trips.add(new TripInfo("FS1DEC13",
+ "Florence and Siena pre-packaged tour 2",
+ "LGW",
+ "FLR",
+ "13/12/09",
+ "20/12/09",
+ "27",
+ 550,
+ "EUR",
+ "http://localhost:8085/tbd" ));
+ }
+
+ public TripItem[] searchSynch(TripLeg tripLeg) {
+ List<TripItem> items = new ArrayList<TripItem>();
+
+ // find the pre-package trip
+ for(TripInfo trip : trips){
+ if ((trip.getFromLocation().equals(tripLeg.getFromLocation())) &&
+ (trip.getToLocation().equals(tripLeg.getToLocation())) &&
+ (trip.getFromDate().equals(tripLeg.getFromDate()))){
+ TripItem item = new TripItem("",
+ "",
+ TripItem.TRIP,
+ trip.getName(),
+ trip.getDescription(),
+ trip.getFromLocation() + " - " + trip.getToLocation(),
+ trip.getFromDate(),
+ trip.getToDate(),
+ trip.getPricePerPerson(),
+ trip.getCurrency(),
+ trip.getLink());
+ items.add(item);
+ }
+ }
+
+ return items.toArray(new TripItem[items.size()]);
+ }
+
+ public void searchAsynch(TripLeg tripLeg) {
+
+ // return available hotels
+ searchCallback.searchResults(searchSynch(tripLeg));
+ }
+
+ public String book(TripItem tripItem) {
+ return "trip1";
+ }
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/trip-contribution/src/main/java/scatours/trip/TripInfo.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/trip-contribution/src/main/java/scatours/trip/TripInfo.java
new file mode 100644
index 0000000000..343a3d2cef
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/trip-contribution/src/main/java/scatours/trip/TripInfo.java
@@ -0,0 +1,142 @@
+/*
+ * 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 scatours.trip;
+
+
+public class TripInfo {
+
+ private String name;
+ private String description;
+ private String fromLocation;
+ private String toLocation;
+ private String fromDate;
+ private String toDate;
+ private String spaces;
+ private double pricePerPerson;
+ private String currency;
+ private String link;
+
+ public TripInfo() {
+ }
+
+ public TripInfo(String name,
+ String description,
+ String fromLocation,
+ String toLocation,
+ String fromDate,
+ String toDate,
+ String spaces,
+ double pricePerPerson,
+ String currency,
+ String link) {
+
+
+ this.name = name;
+ this.description = description;
+ this.fromLocation = fromLocation;
+ this.toLocation = toLocation;
+ this.fromDate = fromDate;
+ this.toDate = toDate;
+ this.spaces = spaces;
+ this.pricePerPerson = pricePerPerson;
+ this.currency = currency;
+ this.link = link;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getFromLocation() {
+ return fromLocation;
+ }
+
+ public void setFromLocation(String fromLocation) {
+ this.fromLocation = fromLocation;
+ }
+
+ public String getToLocation() {
+ return toLocation;
+ }
+
+ public void setToLocation(String toLocation) {
+ this.toLocation = toLocation;
+ }
+
+ public String getFromDate() {
+ return fromDate;
+ }
+
+ public void setFromDate(String fromDate) {
+ this.fromDate = fromDate;
+ }
+
+ public String getToDate() {
+ return toDate;
+ }
+
+ public void setToDate(String toDate) {
+ this.toDate = toDate;
+ }
+
+ public String getSpaces() {
+ return spaces;
+ }
+
+ public void setSpaces(String spaces) {
+ this.spaces = spaces;
+ }
+
+ public double getPricePerPerson() {
+ return pricePerPerson;
+ }
+
+ public void setPricePerPerson(double pricePerPerson) {
+ this.pricePerPerson = pricePerPerson;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/trip-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/trip-contribution/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..8a4f6abf02
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/trip-contribution/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="scatours.common"/>
+ <export.java package="scatours.trip"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/build.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/build.xml
new file mode 100644
index 0000000000..b4fbc726cf
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/build.xml
@@ -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.
+-->
+<project name="gettingstarted" default="compile">
+ <property environment="env"/>
+
+ <target name="compile">
+ <mkdir dir="target/classes"/>
+ <javac srcdir="src" destdir="target/classes"
+ debug="on" source="1.5" target="1.5">
+ <classpath>
+ <pathelement location="${env.TUSCANY}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <target name="run">
+ <java classname="client.CurrencyConverterClient" fork="true">
+ <classpath>
+ <pathelement path="src"/>
+ <pathelement path="target/classes"/>
+ <pathelement location="${env.TUSCANY}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="runtrip">
+ <java classname="client.TripClient" fork="true">
+ <classpath>
+ <pathelement path="src"/>
+ <pathelement path="target/classes"/>
+ <pathelement location="${env.TUSCANY}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="runtripws">
+ <java classname="client.TripWsClient" fork="true">
+ <classpath>
+ <pathelement path="src"/>
+ <pathelement path="target/classes"/>
+ <pathelement location="${env.TUSCANY}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/pom.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/pom.xml
new file mode 100644
index 0000000000..97de81ad2e
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/pom.xml
@@ -0,0 +1,74 @@
+<?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.6-SNAPSHOT</version>
+ <!--relativePath>../../pom.xml</relativePath-->
+ </parent>
+ <artifactId>scatours-tripbooking-contribution</artifactId>
+ <name>Apache Tuscany SCA Tours Trip Booking Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-data-api</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-common-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-currency-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-shoppingcart-contribution</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/src/main/java/scatours/tripbooking/TripBooking.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/src/main/java/scatours/tripbooking/TripBooking.java
new file mode 100644
index 0000000000..72320884e6
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/src/main/java/scatours/tripbooking/TripBooking.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 scatours.tripbooking;
+
+import org.osoa.sca.annotations.Remotable;
+
+import scatours.common.TripItem;
+
+/**
+ * The Trip service interface
+ */
+@Remotable
+public interface TripBooking {
+
+ TripItem bookTrip(String cartId, TripItem trip);
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/src/main/java/scatours/tripbooking/TripBookingImpl.java b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/src/main/java/scatours/tripbooking/TripBookingImpl.java
new file mode 100644
index 0000000000..13c75de1f0
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/src/main/java/scatours/tripbooking/TripBookingImpl.java
@@ -0,0 +1,135 @@
+/*
+ * 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 scatours.tripbooking;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import scatours.common.Book;
+import scatours.common.TripItem;
+import scatours.shoppingcart.ShoppingCart;
+
+/**
+ * An implementation of the Trip service
+ */
+@Service(interfaces={TripBooking.class})
+public class TripBookingImpl implements TripBooking{
+
+ @Reference
+ protected Book hotelBook;
+
+ @Reference
+ protected Book flightBook;
+
+ @Reference
+ protected Book carBook;
+
+ @Reference
+ protected Book tripBook;
+
+ @Reference
+ protected ShoppingCart shoppingCart;
+
+ @Context
+ protected ComponentContext componentContext;
+
+ public TripItem bookTrip(String cartId, TripItem trip) {
+
+ String bookingCode = "";
+
+ // book any nested items
+ TripItem[] nestedItems = trip.getTripItems();
+ if (nestedItems != null){
+ for(int i = 0; i < nestedItems.length; i++ ){
+ TripItem tripItem = nestedItems[i];
+ if (tripItem.getType().equals(TripItem.CAR)){
+ tripItem.setBookingCode(carBook.book(tripItem));
+ } else if (tripItem.getType().equals(TripItem.FLIGHT)){
+ tripItem.setBookingCode(flightBook.book(tripItem));
+ } else if (tripItem.getType().equals(TripItem.HOTEL)){
+ tripItem.setBookingCode(hotelBook.book(tripItem));
+ } else {
+ tripItem.setBookingCode(tripItem.getType() + " is invalid");
+ }
+ }
+ }
+
+ // book the top level item if it's a packaged trip
+ if (trip.getType().equals(TripItem.TRIP)){
+ bookingCode = tripBook.book(trip);
+ trip.setBookingCode(bookingCode);
+ }
+
+ // add trip to the shopping cart
+ //ServiceReference<ShoppingCart> cart = componentContext.getServiceReference(ShoppingCart.class,
+ // "shoppingCart");
+ //cart.setConversationID(cartId);
+ //cart.getService().addTrip(trip);
+
+ return trip;
+ }
+
+ /*
+ @ConversationID
+ protected String conversationId;
+
+ private Map<String, TripItem> tripItems = new HashMap<String, TripItem>();
+
+ // Trip methods
+
+ @Init
+ public void initTrip() {
+ System.out.println("Trip init for id: " + conversationId);
+ }
+
+ @Destroy
+ public void destroyTrip() {
+ System.out.println("Trip destroy for id: " + conversationId);
+ }
+
+
+ public void addTripItem(TripItem tripItem){
+ tripItems.put(tripItem.getId(), tripItem);
+ }
+
+ public void removeTripItem(String id){
+ tripItems.remove(id);
+ }
+
+ public TripItem[] getTripItems() {
+ return tripItems.values().toArray(new TripItem[tripItems.size()]);
+ }
+
+ public double getTripPrice(){
+ double totalPrice = 0.0;
+
+ for (TripItem tripItem : tripItems.values()){
+ totalPrice += tripItem.getPrice();
+ }
+
+ return totalPrice;
+ }
+
+ public void bookTrip() {
+ // TODO
+ }
+ */
+}
diff --git a/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..2accecffaa
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/travelsample/contrib/shared-contributions/tripbooking-contribution/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,25 @@
+<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="scatours.common"/>
+ <import.java package="scatours.currencyconverter"/>
+ <import.java package="scatours.shoppingcart"/>
+ <export.java package="scatours.tripbooking"/>
+</contribution> \ No newline at end of file