diff options
Diffstat (limited to 'sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src')
7 files changed, 0 insertions, 414 deletions
diff --git a/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionConversationClientImpl.java b/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionConversationClientImpl.java deleted file mode 100644 index 7ad0d15442..0000000000 --- a/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionConversationClientImpl.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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.client.impl; - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -import com.tuscanyscatours.common.TripItem; -import com.tuscanyscatours.shoppingcart.CartStore; - -@Scope("COMPOSITE") -@Service(Runnable.class) -public class InteractionConversationClientImpl implements Runnable { - - @Reference - protected CartStore cartStoreConversation; - - public void run() { - System.out.println("\nCalling cart store using the conversational interaction pattern"); - - // add some trip items to the cart store - TripItem tripItem = getTestTripItem(); - cartStoreConversation.addTrip(tripItem); - - tripItem.setDescription("2nd trip item"); - cartStoreConversation.addTrip(tripItem); - - tripItem.setDescription("3rd trip item"); - cartStoreConversation.addTrip(tripItem); - - System.out.println("Trip items now in cart"); - TripItem[] tripItems = cartStoreConversation.getTrips(); - for (TripItem item : tripItems) { - System.out.println("Item - " + item.getDescription()); - } - - System.out.println("Reset the cart"); - cartStoreConversation.reset(); - - System.out.println("Trip items now in cart"); - tripItems = cartStoreConversation.getTrips(); - for (TripItem item : tripItems) { - System.out.println("Item - " + item.getDescription()); - } - } - - private TripItem getTestTripItem() { - TripItem tripItem = new TripItem(); - tripItem.setLocation("FLR"); - tripItem.setFromDate("06/12/09 00:00"); - tripItem.setToDate("13/12/09 00:00"); - tripItem.setDescription("1st trip item"); - return tripItem; - } -} diff --git a/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionLocalClientImpl.java b/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionLocalClientImpl.java deleted file mode 100644 index c12c709461..0000000000 --- a/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionLocalClientImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.client.impl; - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Service; - -import com.tuscanyscatours.calendar.Calendar; -import com.tuscanyscatours.common.TripLeg; - -@Service(Runnable.class) -public class InteractionLocalClientImpl implements Runnable { - - @Reference - protected Calendar calendarLocal; - - public void run() { - System.out.println("\nCalling calendar component over a local binding"); - TripLeg tripLeg = getTestTripLeg(); - String toDate = calendarLocal.getEndDate(tripLeg.getFromDate(), 10); - tripLeg.setToDate(toDate); - System.out.println("Calculated trip end date - " + toDate); - ; - } - - private TripLeg getTestTripLeg() { - TripLeg tripLeg = new TripLeg(); - tripLeg.setFromLocation("LGW"); - tripLeg.setToLocation("FLR"); - tripLeg.setFromDate("06/12/09 00:00"); - tripLeg.setToDate("13/12/09 00:00"); - tripLeg.setNoOfPeople("1"); - tripLeg.setId("TRIP27"); - return tripLeg; - } -} diff --git a/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionOneWayCallbackClientImpl.java b/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionOneWayCallbackClientImpl.java deleted file mode 100644 index 0b52d2d516..0000000000 --- a/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionOneWayCallbackClientImpl.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.client.impl; - -import java.util.concurrent.CountDownLatch; - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -import com.tuscanyscatours.common.Search; -import com.tuscanyscatours.common.SearchCallback; -import com.tuscanyscatours.common.TripItem; -import com.tuscanyscatours.common.TripLeg; - -@Scope("COMPOSITE") -@Service(Runnable.class) -public class InteractionOneWayCallbackClientImpl implements Runnable, SearchCallback { - - @Reference - protected Search hotelSearchOneWayCallback; - - CountDownLatch resultsReceivedCountdown; - - public void run() { - System.out.println("\nCalling hotel component using both one way and callback interation patterns"); - resultsReceivedCountdown = new CountDownLatch(1); - TripLeg tripLeg = getTestTripLeg(); - hotelSearchOneWayCallback.searchAsynch(tripLeg); - - // start other searched here while the hotel search progresses - - // wait for responses to come back - try { - resultsReceivedCountdown.await(); - } catch (InterruptedException ex) { - } - } - - public void searchResults(TripItem[] items) { - for (TripItem tripItem : items) { - System.out.println("Found hotel - " + tripItem.getName()); - } - resultsReceivedCountdown.countDown(); - } - - public void setPercentComplete(String searchComponent, int percentComplete) { - // Not used in this sample - } - - private TripLeg getTestTripLeg() { - TripLeg tripLeg = new TripLeg(); - tripLeg.setFromLocation("LGW"); - tripLeg.setToLocation("FLR"); - tripLeg.setFromDate("06/12/09 00:00"); - tripLeg.setToDate("13/12/09 00:00"); - tripLeg.setNoOfPeople("1"); - tripLeg.setId("TRIP27"); - return tripLeg; - } -} diff --git a/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRemoteClientImpl.java b/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRemoteClientImpl.java deleted file mode 100644 index 0026b2e0b7..0000000000 --- a/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRemoteClientImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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.client.impl; - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Service; - -import com.tuscanyscatours.common.Search; -import com.tuscanyscatours.common.SearchCallback; -import com.tuscanyscatours.common.TripItem; -import com.tuscanyscatours.common.TripLeg; - -@Service(Runnable.class) -public class InteractionRemoteClientImpl implements Runnable, SearchCallback { - - @Reference - protected Search hotelSearchRemote; - - public void run() { - System.out.println("\nCalling hotel component over a remote binding"); - TripLeg tripLeg = getTestTripLeg(); - TripItem[] tripItems = hotelSearchRemote.searchSynch(tripLeg); - for (TripItem tripItem : tripItems) { - System.out.println("Found hotel - " + tripItem.getName()); - } - } - - public void searchResults(TripItem[] items) { - // we are calling the hotel component synchronously here - // so the callback interface is not used - } - - public void setPercentComplete(String searchComponent, int percentComplete) { - // Not used in this sample - } - - private TripLeg getTestTripLeg() { - TripLeg tripLeg = new TripLeg(); - tripLeg.setFromLocation("LGW"); - tripLeg.setToLocation("FLR"); - tripLeg.setFromDate("06/12/09 00:00"); - tripLeg.setToDate("13/12/09 00:00"); - tripLeg.setNoOfPeople("1"); - tripLeg.setId("TRIP27"); - return tripLeg; - } -} diff --git a/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRequestResponseClientImpl.java b/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRequestResponseClientImpl.java deleted file mode 100644 index f25a069713..0000000000 --- a/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRequestResponseClientImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.client.impl; - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Service; - -import com.tuscanyscatours.currencyconverter.CurrencyConverter; - -@Service(Runnable.class) -public class InteractionRequestResponseClientImpl implements Runnable { - - @Reference - protected CurrencyConverter currencyConverterRequestResponse; - - public void run() { - System.out.println("\nCalling currency converter component using request response interation pattern"); - double exchangeRate = currencyConverterRequestResponse.getExchangeRate("GBP", "USD"); - System.out.println("GBP to USD exchange rate is " + exchangeRate); - } - -} diff --git a/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/resources/META-INF/sca-contribution.xml deleted file mode 100644 index 24349299a4..0000000000 --- a/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/resources/META-INF/sca-contribution.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?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://docs.oasis-open.org/ns/opencsa/sca/200912" - xmlns:tours="http://tucsanyscatours.com/"> - <deployable composite="tours:client" /> - <import.java package="com.tuscanyscatours.calendar" /> - <import.java package="com.tuscanyscatours.calendar.impl" /> - <import.java package="com.tuscanyscatours.common" /> - <import.java package="com.tuscanyscatours.currencyconverter" /> - <import.java package="com.tuscanyscatours.currencyconverter.impl" /> - <import.java package="com.tuscanyscatours.shoppingcart" /> - <import.java package="com.tuscanyscatours.shoppingcart.impl" /> -</contribution> diff --git a/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/resources/client.composite b/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/resources/client.composite deleted file mode 100644 index 5fc2006cf0..0000000000 --- a/sca-java-2.x/trunk/tutorials/travelsample/contributions/interaction-client/src/main/resources/client.composite +++ /dev/null @@ -1,77 +0,0 @@ -<?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://docs.oasis-open.org/ns/opencsa/sca/200912" - targetNamespace="http://tuscanyscatours.com/" - name="Client"> - - <!-- Local interaction --> - <component name="InteractionLocalClient"> - <implementation.java class="scatours.client.impl.InteractionLocalClientImpl" /> - <reference name="calendarLocal" - target="Calendar"/> - </component> - - <component name="Calendar"> - <implementation.java class="com.tuscanyscatours.calendar.impl.CalendarImpl"/> - </component> - - <!-- Remote interaction --> - <component name="InteractionRemoteClient"> - <implementation.java class="scatours.client.impl.InteractionRemoteClientImpl" /> - <reference name="hotelSearchRemote"> - <binding.ws uri="http://localhost:8081/Hotel/Search"/> - </reference> - </component> - - <!-- Request response interaction --> - <component name="InteractionRequestResponseClient"> - <implementation.java class="scatours.client.impl.InteractionRequestResponseClientImpl" /> - <reference name="currencyConverterRequestResponse" target="CurrencyConverter"/> - </component> - - <component name="CurrencyConverter"> - <implementation.java class="com.tuscanyscatours.currencyconverter.impl.CurrencyConverterImpl"/> - </component> - - <!-- One way and callback interaction --> - <component name="InteractionOneWayCallbackClient"> - <implementation.java class="scatours.client.impl.InteractionOneWayCallbackClientImpl" /> - <reference name="hotelSearchOneWayCallback"> - <interface.java interface="com.tuscanyscatours.common.Search" - callbackInterface="com.tuscanyscatours.common.SearchCallback"/> - <binding.ws uri="http://localhost:8081/Hotel/Search"/> - <callback> - <binding.ws name="callback" uri="http://localhost:8080/Client/SearchCallback"/> - </callback> - </reference> - </component> - - <!-- Conversational interaction --> - <component name="InteractionConversationClient"> - <implementation.java class="scatours.client.impl.InteractionConversationClientImpl" /> - <reference name="cartStoreConversation" target="CartStore"/> - </component> - - <component name="CartStore"> - <implementation.java class="com.tuscanyscatours.shoppingcart.impl.CartStoreImpl"/> - <service name="CartStore"/> - </component> - -</composite> |