diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2008-08-31 12:27:58 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2008-08-31 12:27:58 +0000 |
commit | bcbd8cb0b78cf576d73a0140476b2996a36e5245 (patch) | |
tree | fa4ff621017da31c51e8f591325cd42d6cad3686 /sandbox | |
parent | c9ca42a3aa4ac890695ec10e7746b9895fc2cf64 (diff) |
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
Diffstat (limited to 'sandbox')
11 files changed, 93 insertions, 33 deletions
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 @@ <dependencies> <dependency> <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-host-embedded</artifactId> + <artifactId>tuscany-node2-impl</artifactId> <version>1.4-SNAPSHOT</version> + <scope>runtime</scope> </dependency> <dependency> 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. --> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" - targetNamespace="http://scatours" - xmlns:sample="http://scatours" + targetNamespace="http://tuscanyscatours" + xmlns:sample="http://tuscanyscatours" name="currencyconverter"> <component name="CurrencyConverterComponent"> 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. --> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" - targetNamespace="http://scatours" - xmlns:sample="http://scatours" + targetNamespace="http://tuscanyscatours" + xmlns:sample="http://tuscanyscatours" name="trip"> <component name="TripComponent"> 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. --> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" - targetNamespace="http://scatours" - xmlns:sample="http://scatours" + targetNamespace="http://tuscanyscatours" + xmlns:sample="http://tuscanyscatours" name="tripws"> <component name="TripComponent"> 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 @@ <include name="tuscany-interface-wsdl-xml-1.4-SNAPSHOT.jar"/> <include name="tuscany-monitor-1.4-SNAPSHOT.jar"/> <include name="tuscany-monitor-logging-1.4-SNAPSHOT.jar"/> + <include name="tuscany-node-api-1.4-SNAPSHOT.jar"/> + <include name="tuscany-node-impl-1.4-SNAPSHOT.jar"/> + <include name="tuscany-node-launcher-1.4-SNAPSHOT.jar"/> <include name="tuscany-node-manager-1.4-SNAPSHOT.jar"/> <include name="tuscany-node2-api-1.4-SNAPSHOT.jar"/> - <include name="tuscany-node2-impl-1.4-SNAPSHOT.jar"/> <include name="tuscany-node2-launcher-1.4-SNAPSHOT.jar"/> <include name="tuscany-policy-1.4-SNAPSHOT.jar"/> <include name="tuscany-policy-security-1.4-SNAPSHOT.jar"/> @@ -134,9 +136,14 @@ </fileset> <fileset id="3rdparty.jars" dir="../../lib"> <include name="XmlSchema-1.3.2.jar"/> - <include name="abdera-core-0.3.0-incubating.jar"/> - <include name="abdera-i18n-0.3.0-incubating.jar"/> - <include name="abdera-parser-0.3.0-incubating.jar"/> + <include name="abdera-client-0.4.0-incubating.jar"/> + <include name="abdera-core-0.4.0-incubating.jar"/> + <include name="abdera-extensions-html-0.4.0-incubating.jar"/> + <include name="abdera-extensions-json-0.4.0-incubating.jar"/> + <include name="abdera-extensions-main-0.4.0-incubating.jar"/> + <include name="abdera-i18n-0.4.0-incubating.jar"/> + <include name="abdera-parser-0.4.0-incubating.jar"/> + <include name="abdera-server-0.4.0-incubating.jar"/> <include name="activation-1.1.jar"/> <include name="annogen-0.1.0.jar"/> <include name="asm-all-3.1.jar"/> @@ -160,12 +167,13 @@ <include name="commons-io-1.1.jar"/> <include name="commons-logging-1.1.jar"/> <include name="derby-10.3.1.4.jar"/> - <include name="dom4j-1.6.1.jar"/> <include name="geronimo-activation_1.1_spec-1.0-M1.jar"/> <include name="geronimo-commonj_1.1_spec-1.0.jar"/> <include name="geronimo-ejb_3.0_spec-1.0.jar"/> <include name="geronimo-javamail_1.4_spec-1.0-M1.jar"/> <include name="geronimo-jms_1.1_spec-1.1.jar"/> + <include name="geronimo-stax-api_1.0_spec-1.0.1.jar"/> + <include name="htmlparser-1.0.5.jar"/> <include name="httpcore-4.0-alpha5.jar"/> <include name="httpcore-nio-4.0-alpha5.jar"/> <include name="httpcore-niossl-4.0-alpha5.jar"/> @@ -173,7 +181,6 @@ <include name="jaxb-impl-2.1.7.jar"/> <include name="jaxen-1.1.1.jar"/> <include name="jaxws-api-2.1.jar"/> - <include name="jdom-1.0.jar"/> <include name="jettison-1.0.1.jar"/> <include name="jetty-6.1.7.jar"/> <include name="jetty-util-6.1.7.jar"/> 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<Search> 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 @@ <include name="tuscany-endpoint-1.4-SNAPSHOT.jar"/> <include name="tuscany-extensibility-1.4-SNAPSHOT.jar"/> <include name="tuscany-host-embedded-1.4-SNAPSHOT.jar"/> + <include name="tuscany-implementation-node-1.4-SNAPSHOT.jar"/> <include name="tuscany-interface-1.4-SNAPSHOT.jar"/> <include name="tuscany-interface-java-1.4-SNAPSHOT.jar"/> <include name="tuscany-interface-java-jaxws-1.4-SNAPSHOT.jar"/> <include name="tuscany-interface-java-xml-1.4-SNAPSHOT.jar"/> <include name="tuscany-monitor-1.4-SNAPSHOT.jar"/> + <include name="tuscany-node-api-1.4-SNAPSHOT.jar"/> + <include name="tuscany-node-impl-1.4-SNAPSHOT.jar"/> <include name="tuscany-policy-1.4-SNAPSHOT.jar"/> <include name="tuscany-policy-xml-1.4-SNAPSHOT.jar"/> <include name="tuscany-sca-api-1.4-SNAPSHOT.jar"/> 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 @@ <service name="TravelBooking"> <tuscany:binding.jsonrpc/> </service> - <reference name="hotelSearch" target="HotelComponent/Search"> + <reference name="hotelSearch" target="HotelComponent"> <binding.sca/> </reference> - <reference name="flightSearch" target="FlightComponent"> - <binding.sca/> + <reference name="flightSearch"> + <interface.java interface="scatours.common.Search" + callbackInterface="scatours.common.SearchCallback"/> + <binding.ws uri="http://localhost:8080/Flight/Search"/> + <callback> + <binding.ws uri="http://localhost:8080/Flight/SearchCallback"/> + </callback> </reference> <reference name="carSearch" target="CarComponent"> <binding.sca/> @@ -68,6 +73,7 @@ </reference> <property name="quoteCurrencyCode">GBP</property> </component> + <component name="TripComponent"> <implementation.java class="scatours.trip.TripImpl"/> <service name="Trip"> @@ -85,8 +91,13 @@ <component name="FlightComponent"> <implementation.java class="scatours.flight.FlightImpl"/> <service name="Search"> - <binding.sca/> + <interface.java interface="scatours.common.Search" + callbackInterface="scatours.common.SearchCallback"/> + <binding.ws uri="http://localhost:8080/Flight/Search"/> <tuscany:binding.jsonrpc/> + <callback> + <binding.ws uri="http://localhost:8080/Flight/SearchCallback"/> + </callback> </service> </component> |