From bcbd8cb0b78cf576d73a0140476b2996a36e5245 Mon Sep 17 00:00:00 2001 From: slaws Date: Sun, 31 Aug 2008 12:27:58 +0000 Subject: Namespace changes from scatours to tuscanyscatours and addition of callback configuration. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@690687 13f79535-47bb-0310-9956-ffa450edef68 --- sandbox/travelsample/gettingstarted/pom.xml | 3 ++- .../src/client/CurrencyConverterClient.java | 20 +++++++++++++++----- .../gettingstarted/src/client/TripClient.java | 16 ++++++++++++---- .../gettingstarted/src/client/TripWsClient.java | 21 +++++++++++++++------ .../gettingstarted/src/currencyconverter.composite | 4 ++-- .../travelsample/gettingstarted/src/trip.composite | 4 ++-- .../gettingstarted/src/tripws.composite | 4 ++-- sandbox/travelsample/node/build.xml | 19 +++++++++++++------ .../src/scatours/travel/TravelImpl.java | 13 ++++++++++++- sandbox/travelsample/ui-contribution/build.xml | 3 +++ .../travelsample/ui-contribution/scatours.composite | 19 +++++++++++++++---- 11 files changed, 93 insertions(+), 33 deletions(-) (limited to 'sandbox') diff --git a/sandbox/travelsample/gettingstarted/pom.xml b/sandbox/travelsample/gettingstarted/pom.xml index 91012e3f6e..c038d823ea 100644 --- a/sandbox/travelsample/gettingstarted/pom.xml +++ b/sandbox/travelsample/gettingstarted/pom.xml @@ -31,8 +31,9 @@ org.apache.tuscany.sca - tuscany-host-embedded + tuscany-node2-impl 1.4-SNAPSHOT + runtime diff --git a/sandbox/travelsample/gettingstarted/src/client/CurrencyConverterClient.java b/sandbox/travelsample/gettingstarted/src/client/CurrencyConverterClient.java index 92c00fba07..79f274fa65 100644 --- a/sandbox/travelsample/gettingstarted/src/client/CurrencyConverterClient.java +++ b/sandbox/travelsample/gettingstarted/src/client/CurrencyConverterClient.java @@ -19,6 +19,11 @@ package client; import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; + +import trip.Trip; import currencyconverter.CurrencyConverter; /** @@ -27,12 +32,17 @@ import currencyconverter.CurrencyConverter; public class CurrencyConverterClient { public final static void main(String[] args) throws Exception { - SCADomain scaDomain = - SCADomain.newInstance("currencyconverter.composite"); + SCANode2Factory factory = SCANode2Factory.newInstance(); + SCANode2 node = factory.createSCANodeFromClassLoader("currencyconverter.composite", + null); + node.start(); + CurrencyConverter currencyConverter = - scaDomain.getService(CurrencyConverter.class, - "CurrencyConverterComponent"); + ((SCAClient)node).getService(CurrencyConverter.class, + "CurrencyConverterComponent"); + System.out.println(currencyConverter.convert("GBP", "USD", 10.00)); - scaDomain.close(); + + node.stop(); } } diff --git a/sandbox/travelsample/gettingstarted/src/client/TripClient.java b/sandbox/travelsample/gettingstarted/src/client/TripClient.java index 73aa5e2146..36616569a4 100644 --- a/sandbox/travelsample/gettingstarted/src/client/TripClient.java +++ b/sandbox/travelsample/gettingstarted/src/client/TripClient.java @@ -18,7 +18,9 @@ */ package client; -import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; import trip.Trip; @@ -28,10 +30,16 @@ import trip.Trip; public class TripClient { public final static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("trip.composite"); - Trip trip = scaDomain.getService(Trip.class, "TripComponent"); + SCANode2Factory factory = SCANode2Factory.newInstance(); + SCANode2 node = factory.createSCANodeFromClassLoader("trip.composite", + null); + node.start(); + + Trip trip = ((SCAClient)node).getService(Trip.class, + "TripComponent"); + System.out.println(trip.getTotalPrice()); - scaDomain.close(); + node.stop(); } } diff --git a/sandbox/travelsample/gettingstarted/src/client/TripWsClient.java b/sandbox/travelsample/gettingstarted/src/client/TripWsClient.java index 2df62d1d3c..54dcb4e52a 100644 --- a/sandbox/travelsample/gettingstarted/src/client/TripWsClient.java +++ b/sandbox/travelsample/gettingstarted/src/client/TripWsClient.java @@ -19,6 +19,9 @@ package client; import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; import trip.Trip; @@ -28,13 +31,19 @@ import trip.Trip; public class TripWsClient { public final static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("tripws.composite"); - Trip trip = scaDomain.getService(Trip.class, "TripComponent"); - System.out.println(trip.getTotalPrice()); + SCANode2Factory factory = SCANode2Factory.newInstance(); + SCANode2 node = factory.createSCANodeFromClassLoader("tripws.composite", + null); + node.start(); + + Trip trip = ((SCAClient)node).getService(Trip.class, + "TripComponent"); - System.out.println("press enter to continue"); - System.in.read(); + System.out.println(trip.getTotalPrice()); - scaDomain.close(); + System.out.println("press enter to continue"); + System.in.read(); + + node.stop(); } } diff --git a/sandbox/travelsample/gettingstarted/src/currencyconverter.composite b/sandbox/travelsample/gettingstarted/src/currencyconverter.composite index ae94401f6c..2a37151e08 100644 --- a/sandbox/travelsample/gettingstarted/src/currencyconverter.composite +++ b/sandbox/travelsample/gettingstarted/src/currencyconverter.composite @@ -18,8 +18,8 @@ * under the License. --> diff --git a/sandbox/travelsample/gettingstarted/src/trip.composite b/sandbox/travelsample/gettingstarted/src/trip.composite index ee5c6812db..32a3eed4be 100644 --- a/sandbox/travelsample/gettingstarted/src/trip.composite +++ b/sandbox/travelsample/gettingstarted/src/trip.composite @@ -18,8 +18,8 @@ * under the License. --> diff --git a/sandbox/travelsample/gettingstarted/src/tripws.composite b/sandbox/travelsample/gettingstarted/src/tripws.composite index 2031ca5382..dd399ee92a 100644 --- a/sandbox/travelsample/gettingstarted/src/tripws.composite +++ b/sandbox/travelsample/gettingstarted/src/tripws.composite @@ -18,8 +18,8 @@ * under the License. --> diff --git a/sandbox/travelsample/node/build.xml b/sandbox/travelsample/node/build.xml index f5faece1ea..a8e3af938c 100644 --- a/sandbox/travelsample/node/build.xml +++ b/sandbox/travelsample/node/build.xml @@ -116,9 +116,11 @@ + + + - @@ -134,9 +136,14 @@ - - - + + + + + + + + @@ -160,12 +167,13 @@ - + + @@ -173,7 +181,6 @@ - diff --git a/sandbox/travelsample/travel-contribution/src/scatours/travel/TravelImpl.java b/sandbox/travelsample/travel-contribution/src/scatours/travel/TravelImpl.java index e5cc0cae8f..cbd50e5b35 100644 --- a/sandbox/travelsample/travel-contribution/src/scatours/travel/TravelImpl.java +++ b/sandbox/travelsample/travel-contribution/src/scatours/travel/TravelImpl.java @@ -26,7 +26,9 @@ import java.util.UUID; import org.apache.tuscany.sca.data.collection.Entry; import org.apache.tuscany.sca.data.collection.NotFoundException; +import org.osoa.sca.CallableReference; 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; @@ -81,7 +83,12 @@ public class TravelImpl implements TravelSearch, SearchCallback, TravelBooking{ searchResults.clear(); responsesReceived = 0; - hotelSearch.searchAsynch(tripLeg); + ServiceReference dynamicHotelSearch = + componentContext.getServiceReference(Search.class, "hotelSearch"); + + dynamicHotelSearch.setCallbackID("HotelSearchCallbackID-" + tripLeg.getId()); + dynamicHotelSearch.getService().searchAsynch(tripLeg); + flightSearch.searchAsynch(tripLeg); carSearch.searchAsynch(tripLeg); @@ -110,6 +117,10 @@ public class TravelImpl implements TravelSearch, SearchCallback, TravelBooking{ // SearchCallback methods public void searchResults(TripItem[] items){ + RequestContext requestContext = componentContext.getRequestContext(); + Object callbackID = requestContext.getServiceReference().getCallbackID(); + System.out.println(callbackID); + for(int i = 0; i < items.length; i++ ){ searchResults.add(items[i]); } diff --git a/sandbox/travelsample/ui-contribution/build.xml b/sandbox/travelsample/ui-contribution/build.xml index 5444c953ff..bb56d1bd60 100644 --- a/sandbox/travelsample/ui-contribution/build.xml +++ b/sandbox/travelsample/ui-contribution/build.xml @@ -77,11 +77,14 @@ + + + diff --git a/sandbox/travelsample/ui-contribution/scatours.composite b/sandbox/travelsample/ui-contribution/scatours.composite index fc28b0a884..8e9a403d4a 100644 --- a/sandbox/travelsample/ui-contribution/scatours.composite +++ b/sandbox/travelsample/ui-contribution/scatours.composite @@ -53,11 +53,16 @@ - + - - + + + + + + @@ -68,6 +73,7 @@ GBP + @@ -85,8 +91,13 @@ - + + + + + -- cgit v1.2.3