summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2010-04-20 22:27:34 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2010-04-20 22:27:34 +0000
commit54e785c9a15bc1286757c147323b697a6c40a640 (patch)
tree1753072ba5b7468376d8ca7cf2d921126daca90c /sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours
parentf094477f3cda79a3918b02e29aa233001c7e4193 (diff)
Copy 1.x travel sample to branches for start of 1.0 travel sample release
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@936092 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/build.xml22
-rw-r--r--sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/pom.xml42
-rw-r--r--sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/goodvaluetrips/Trips.java26
-rw-r--r--sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Bookings.java26
-rw-r--r--sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Checkout.java28
-rw-r--r--sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Updates.java26
-rw-r--r--sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java49
-rw-r--r--sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/resources/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/resources/tours.composite46
10 files changed, 328 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/build.xml
new file mode 100644
index 0000000000..f269f6577b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/build.xml
@@ -0,0 +1,22 @@
+<!--
+ * 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="scatours-contribution-introducing-tours" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/pom.xml
new file mode 100644
index 0000000000..90839f94d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/pom.xml
@@ -0,0 +1,42 @@
+<?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>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-introducing-tours</artifactId>
+ <name>Apache Tuscany SCA Tours Introducing Tours Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/goodvaluetrips/Trips.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/goodvaluetrips/Trips.java
new file mode 100644
index 0000000000..365a210368
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/goodvaluetrips/Trips.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.goodvaluetrips;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Trips {
+ String checkAvailability(String trip, int people);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Bookings.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Bookings.java
new file mode 100644
index 0000000000..9d54d46bb6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Bookings.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Bookings {
+ String newBooking(String trip, int people);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Checkout.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Checkout.java
new file mode 100644
index 0000000000..29c84d2bc0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Checkout.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 com.tuscanyscatours;
+
+import java.math.BigDecimal;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Checkout {
+ void makePayment(BigDecimal amount, String cardInfo);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Updates.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Updates.java
new file mode 100644
index 0000000000..e33b0399cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Updates.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Updates {
+ void addTrip(String resCode);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java
new file mode 100644
index 0000000000..629ea7b5ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.impl;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.tuscanyscatours.Checkout;
+import com.tuscanyscatours.Updates;
+
+public class ShoppingCartImpl implements Checkout, Updates {
+ private static List<String> bookedTrips = new ArrayList<String>();
+
+ protected String currency = "USD";
+
+ public void makePayment(BigDecimal amount, String cardInfo) {
+ System.out.print("Charged " + currency + " " + amount
+ + " to card "
+ + cardInfo
+ + " for "
+ + (bookedTrips.size() > 1 ? "trips" : "trip"));
+ for (String trip : bookedTrips) {
+ System.out.print(" " + trip);
+ }
+ System.out.println();
+ bookedTrips.clear();
+ }
+
+ public void addTrip(String resCode) {
+ bookedTrips.add(resCode);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java
new file mode 100644
index 0000000000..f2884f87c5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.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 com.tuscanyscatours.impl;
+
+import org.osoa.sca.annotations.Reference;
+
+import com.goodvaluetrips.Trips;
+import com.tuscanyscatours.Bookings;
+import com.tuscanyscatours.Updates;
+
+public class TripBookingImpl implements Bookings {
+ @Reference
+ protected Trips mytrips;
+
+ @Reference
+ protected Updates cart;
+
+ public String newBooking(String trip, int people) {
+ String resCode = mytrips.checkAvailability(trip, people);
+ cart.addTrip(resCode);
+ return "GV" + resCode;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..5f76588dad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/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"
+ xmlns:tst="http://tuscanyscatours.com/">
+ <export.java package="com.tuscanyscatours" />
+ <deployable composite="tst:Tours" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/resources/tours.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/resources/tours.composite
new file mode 100644
index 0000000000..6d47793aa4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/resources/tours.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://tuscanyscatours.com/"
+ name="Tours">
+
+ <component name="TripBooking">
+ <implementation.java class="com.tuscanyscatours.impl.TripBookingImpl" />
+ <service name="Bookings">
+ <interface.java interface="com.tuscanyscatours.Bookings" />
+ </service>
+ <reference name="mytrips" target="TripProvider/Trips">
+ <interface.java interface="com.goodvaluetrips.Trips" />
+ </reference>
+ <reference name="cart" target="ShoppingCart/Updates">
+ <interface.java interface="com.tuscanyscatours.Updates" />
+ </reference>
+ </component>
+
+ <component name="ShoppingCart">
+ <implementation.java class="com.tuscanyscatours.impl.ShoppingCartImpl"/>
+ <service name="Checkout">
+ <interface.java interface="com.tuscanyscatours.Checkout" />
+ </service>
+ <service name="Updates">
+ <interface.java interface="com.tuscanyscatours.Updates" />
+ </service>
+ </component>
+</composite>