summaryrefslogtreecommitdiffstats
path: root/sandbox/travelsample/launchers/introducing-launcher/src/main
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-05-17 15:23:10 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-05-17 15:23:10 +0000
commit8c750d3140ad9cfd8b7af778c50fbbf526a6d198 (patch)
treea584be48bea5eb7c6cfab8824c993fc006194c45 /sandbox/travelsample/launchers/introducing-launcher/src/main
parent25bc47ea8f541b5ecf2b864ab41d40d116b1afd7 (diff)
Add a little more function to the simple travel booking sample and simplify the command line launcher contribution configuration.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@775672 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/travelsample/launchers/introducing-launcher/src/main')
-rw-r--r--sandbox/travelsample/launchers/introducing-launcher/src/main/java/scatours/Bookings.java26
-rw-r--r--sandbox/travelsample/launchers/introducing-launcher/src/main/java/scatours/Checkout.java28
-rw-r--r--sandbox/travelsample/launchers/introducing-launcher/src/main/java/scatours/LaunchNode.java23
-rw-r--r--sandbox/travelsample/launchers/introducing-launcher/src/main/resources/scatours.composite2
4 files changed, 72 insertions, 7 deletions
diff --git a/sandbox/travelsample/launchers/introducing-launcher/src/main/java/scatours/Bookings.java b/sandbox/travelsample/launchers/introducing-launcher/src/main/java/scatours/Bookings.java
new file mode 100644
index 0000000000..a8e3ea5ccf
--- /dev/null
+++ b/sandbox/travelsample/launchers/introducing-launcher/src/main/java/scatours/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 scatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Bookings {
+ String newBooking(String trip, int people);
+}
diff --git a/sandbox/travelsample/launchers/introducing-launcher/src/main/java/scatours/Checkout.java b/sandbox/travelsample/launchers/introducing-launcher/src/main/java/scatours/Checkout.java
new file mode 100644
index 0000000000..3b8f8b3130
--- /dev/null
+++ b/sandbox/travelsample/launchers/introducing-launcher/src/main/java/scatours/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 scatours;
+
+import java.math.BigDecimal;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Checkout {
+ void makePayment(BigDecimal amount, String cardInfo);
+}
diff --git a/sandbox/travelsample/launchers/introducing-launcher/src/main/java/scatours/LaunchNode.java b/sandbox/travelsample/launchers/introducing-launcher/src/main/java/scatours/LaunchNode.java
index 8ed40a8c06..764a8c0854 100644
--- a/sandbox/travelsample/launchers/introducing-launcher/src/main/java/scatours/LaunchNode.java
+++ b/sandbox/travelsample/launchers/introducing-launcher/src/main/java/scatours/LaunchNode.java
@@ -19,6 +19,9 @@
package scatours;
+import java.io.IOException;
+import java.math.BigDecimal;
+
import org.apache.tuscany.sca.node.SCAClient;
import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode;
@@ -33,16 +36,24 @@ public class LaunchNode {
// OK for development but you must launch the node from this module
public static void launchFromFileSystemDir(){
try {
- SCANode node = SCANodeFactory.newInstance().createSCANode("scatours.composite",
+ SCANode node = SCANodeFactory.newInstance().createSCANode(null,
new SCAContribution("goodvaluetrips", "../../contributions/introducing-goodvaluetrips-contribution/target/classes"),
- new SCAContribution("tuscanyscatours", "../../contributions/introducing-tuscanyscatours-contribution/target/classes"),
- new SCAContribution("client", "../../contributions/introducing-client-contribution/target/classes"),
- new SCAContribution("launcher", "./target/classes"));
+ new SCAContribution("tuscanyscatours", "../../contributions/introducing-tuscanyscatours-contribution/target/classes"));
+
node.start();
- Runnable runner = ((SCAClient)node).getService(Runnable.class, "TestClient/Runnable");
- runner.run();
+ Bookings bookings = ((SCAClient)node).getService(Bookings.class,
+ "TripBooking/Bookings");
+ System.out.println("Trip boooking code = " +
+ bookings.newBooking("FS1APR4", 1));
+
+ Checkout checkout = ((SCAClient)node).getService(Checkout.class,
+ "ShoppingCart/Checkout");
+
+ checkout.makePayment(new BigDecimal("1995.00"), "1234567843218765 10/10");
+
+
node.stop();
} catch (Throwable th) {
diff --git a/sandbox/travelsample/launchers/introducing-launcher/src/main/resources/scatours.composite b/sandbox/travelsample/launchers/introducing-launcher/src/main/resources/scatours.composite
index a5e26fd7b7..eaa19f6174 100644
--- a/sandbox/travelsample/launchers/introducing-launcher/src/main/resources/scatours.composite
+++ b/sandbox/travelsample/launchers/introducing-launcher/src/main/resources/scatours.composite
@@ -23,7 +23,7 @@
xmlns:tours="http://tuscanyscatours.com/"
xmlns:trips="http://goodvaluetrips.com/"
name="scatours">
-
+
<include name="client:Client" />
<include name="tours:Tours" />
<include name="trips:Trips" />