summaryrefslogtreecommitdiffstats
path: root/sandbox
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/travelsample/clients/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBAClient.java18
-rw-r--r--sandbox/travelsample/clients/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSClient.java77
-rw-r--r--sandbox/travelsample/clients/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java9
-rw-r--r--sandbox/travelsample/clients/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMIClient.java15
-rw-r--r--sandbox/travelsample/clients/currency-converter-ws-jaxws/src/main/java/scatours/CurrencyConverterWSClient.java12
-rw-r--r--sandbox/travelsample/contrib/2.x/creditcard-payment-dosgi-contribution/src/main/java/scatours/payment/creditcard/impl/CreditCardPaymentImpl.java2
-rw-r--r--sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/AtomBlogFeedImpl.java3
-rw-r--r--sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/BaseBlogFeedImpl.java13
-rw-r--r--sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/GenericBlogFeedImpl.java11
-rw-r--r--sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/RSSBlogFeedImpl.java8
-rw-r--r--sandbox/travelsample/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/impl/CalendarImpl.java8
-rw-r--r--sandbox/travelsample/contributions/calendar/src/test/java/scatours/calendar/CalendarTestCase.java9
-rw-r--r--sandbox/travelsample/contributions/car/src/main/java/com/tuscanyscatours/car/impl/CarImpl.java78
-rw-r--r--sandbox/travelsample/contributions/car/src/main/java/com/tuscanyscatours/car/impl/CarInfo.java68
-rw-r--r--sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/Search.java4
-rw-r--r--sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/SearchCallback.java1
-rw-r--r--sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/TripItem.java148
-rw-r--r--sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/TripLeg.java48
-rw-r--r--sandbox/travelsample/contributions/creditcard-payment-jaxb-policy/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java20
-rw-r--r--sandbox/travelsample/contributions/creditcard-payment-jaxb-policy/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java30
-rw-r--r--sandbox/travelsample/contributions/creditcard-payment-jaxb/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java20
-rw-r--r--sandbox/travelsample/contributions/creditcard-payment-jaxb/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java30
-rw-r--r--sandbox/travelsample/contributions/creditcard-payment-sdo/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardPayment.java10
-rw-r--r--sandbox/travelsample/contributions/creditcard-payment-sdo/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java17
-rw-r--r--sandbox/travelsample/contributions/creditcard-payment-sdo/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java21
-rw-r--r--sandbox/travelsample/contributions/currency-servlet/src/main/java/com/tuscanyscatours/currencyconverter/servlet/CurrencyConverterServlet.java14
-rw-r--r--sandbox/travelsample/contributions/currency/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java9
-rw-r--r--sandbox/travelsample/contributions/currency/src/main/java/com/tuscanyscatours/currencyconverter/impl/CurrencyConverterImpl.java26
-rw-r--r--sandbox/travelsample/contributions/databinding-client/src/main/java/scatours/client/TestClient.java4
-rw-r--r--sandbox/travelsample/contributions/emailgateway/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java3
-rw-r--r--sandbox/travelsample/contributions/emailgateway/src/test/java/scatours/emailgateway/EmailGatewayTestCase.java20
-rw-r--r--sandbox/travelsample/contributions/feed-logger/src/main/java/com/tuscanyscatours/feedlogger/impl/FeedLoggerImpl.java5
-rw-r--r--sandbox/travelsample/contributions/flight/src/main/java/com/tuscanyscatours/flight/impl/FlightImpl.java115
-rw-r--r--sandbox/travelsample/contributions/flight/src/main/java/com/tuscanyscatours/flight/impl/FlightInfo.java64
-rw-r--r--sandbox/travelsample/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/HotelInfo.java68
-rw-r--r--sandbox/travelsample/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/impl/HotelImpl.java101
-rw-r--r--sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionConversationClientImpl.java45
-rw-r--r--sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionLocalClientImpl.java35
-rw-r--r--sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionOneWayCallbackClientImpl.java62
-rw-r--r--sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRemoteClientImpl.java52
-rw-r--r--sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRequestResponseClientImpl.java15
-rw-r--r--sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionStatefulCallbackClientImpl.java72
-rw-r--r--sandbox/travelsample/contributions/introducing-client/src/main/java/scatours/client/impl/TestClientImpl.java6
-rw-r--r--sandbox/travelsample/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java23
-rw-r--r--sandbox/travelsample/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java5
-rw-r--r--sandbox/travelsample/contributions/notification/src/main/java/com/tuscanyscatours/notification/Notification.java4
-rw-r--r--sandbox/travelsample/contributions/notification/src/main/java/com/tuscanyscatours/notification/impl/NotificationImpl.java51
-rw-r--r--sandbox/travelsample/contributions/payment-bpel/src/test/java/scatours/payment/PaymentTestCase.java42
-rw-r--r--sandbox/travelsample/contributions/payment-groovy/src/test/java/scatours/payment/PaymentTestCase.java42
-rw-r--r--sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java1
-rw-r--r--sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java10
-rw-r--r--sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java1
-rw-r--r--sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java15
-rw-r--r--sandbox/travelsample/contributions/payment-java-policy/src/test/java/scatours/payment/PaymentTestCase.java22
-rw-r--r--sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java1
-rw-r--r--sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java10
-rw-r--r--sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java1
-rw-r--r--sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java16
-rw-r--r--sandbox/travelsample/contributions/payment-java/src/test/java/scatours/payment/PaymentTestCase.java22
-rw-r--r--sandbox/travelsample/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java1
-rw-r--r--sandbox/travelsample/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java11
-rw-r--r--sandbox/travelsample/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java28
-rw-r--r--sandbox/travelsample/contributions/payment-spring-policy/src/test/java/scatours/payment/PaymentTestCase.java27
-rw-r--r--sandbox/travelsample/contributions/payment-spring-policy/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java3
-rw-r--r--sandbox/travelsample/contributions/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java23
-rw-r--r--sandbox/travelsample/contributions/payment-spring-scatag/src/test/java/scatours/payment/PaymentTestCase.java28
-rw-r--r--sandbox/travelsample/contributions/payment-spring-scatag/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java3
-rw-r--r--sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java1
-rw-r--r--sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java10
-rw-r--r--sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java28
-rw-r--r--sandbox/travelsample/contributions/payment-spring/src/test/java/scatours/payment/PaymentTestCase.java27
-rw-r--r--sandbox/travelsample/contributions/payment-spring/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java3
-rw-r--r--sandbox/travelsample/contributions/policy-client/src/main/java/scatours/client/TestClient.java2
-rw-r--r--sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursBooking.java1
-rw-r--r--sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursCart.java6
-rw-r--r--sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/impl/SCAToursImpl.java52
-rw-r--r--sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartCheckout.java2
-rw-r--r--sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartInitialize.java1
-rw-r--r--sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartStore.java10
-rw-r--r--sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartUpdates.java5
-rw-r--r--sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/CartStoreImpl.java26
-rw-r--r--sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/ShoppingCartImpl.java67
-rw-r--r--sandbox/travelsample/contributions/travelcatalog/src/main/java/com/tuscanyscatours/travelcatalog/impl/TravelCatalogImpl.java92
-rw-r--r--sandbox/travelsample/contributions/trip/src/main/java/com/tuscanyscatours/trip/impl/TripImpl.java89
-rw-r--r--sandbox/travelsample/contributions/trip/src/main/java/com/tuscanyscatours/trip/impl/TripInfo.java66
-rw-r--r--sandbox/travelsample/contributions/trip/src/test/java/scatours/trip/TripTestCase.java32
-rw-r--r--sandbox/travelsample/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/TripBooking.java2
-rw-r--r--sandbox/travelsample/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/impl/TripBookingImpl.java57
-rw-r--r--sandbox/travelsample/launchers/blog-feed/src/main/java/scatours/BlogFeedLauncher.java6
-rw-r--r--sandbox/travelsample/launchers/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBALauncher.java23
-rw-r--r--sandbox/travelsample/launchers/currency-converter-corba/src/main/java/scatours/currencyconverter/CurrencyConverter.java9
-rw-r--r--sandbox/travelsample/launchers/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSLauncher.java6
-rw-r--r--sandbox/travelsample/launchers/currency-converter-jms/src/main/java/scatours/JMSBrokerLauncher.java20
-rw-r--r--sandbox/travelsample/launchers/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java9
-rw-r--r--sandbox/travelsample/launchers/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMILauncher.java23
-rw-r--r--sandbox/travelsample/launchers/currency-converter-ws/src/main/java/scatours/CurrencyConverterWSLauncher.java23
-rw-r--r--sandbox/travelsample/launchers/currency-converter-ws/src/main/java/scatours/currencyconverter/CurrencyConverter.java9
-rw-r--r--sandbox/travelsample/launchers/currency-converter/src/main/java/scatours/CurrencyConverterLauncher.java17
-rw-r--r--sandbox/travelsample/launchers/currency-converter/src/main/java/scatours/currencyconverter/CurrencyConverter.java9
-rw-r--r--sandbox/travelsample/launchers/databinding/src/main/java/scatours/DatabindingLauncher.java13
-rw-r--r--sandbox/travelsample/launchers/feed-logger/src/main/java/scatours/FeedLoggerLauncher.java11
-rw-r--r--sandbox/travelsample/launchers/fullapp-nodes/src/main/java/scatours/FullAppNodesLauncher.java34
-rw-r--r--sandbox/travelsample/launchers/fullapp/src/main/java/scatours/FullAppLauncher.java1
-rw-r--r--sandbox/travelsample/launchers/help-pages/src/main/java/scatours/HelpPagesLauncher.java6
-rw-r--r--sandbox/travelsample/launchers/interaction/src/main/java/scatours/InteractionLauncher.java60
-rw-r--r--sandbox/travelsample/launchers/interaction/src/test/java/scatours/InteractionTestCase.java2
-rw-r--r--sandbox/travelsample/launchers/introducing-client/src/main/java/scatours/IntroducingClientLauncher.java5
-rw-r--r--sandbox/travelsample/launchers/introducing/src/main/java/scatours/IntroducingLauncher.java11
-rw-r--r--sandbox/travelsample/launchers/introducing/src/test/java/scatours/IntroducingTestCase.java13
-rw-r--r--sandbox/travelsample/launchers/jumpstart/src/main/java/scatours/JumpstartLauncher.java19
-rw-r--r--sandbox/travelsample/launchers/jumpstart/src/test/java/scatours/JumpstartTestCase.java10
-rw-r--r--sandbox/travelsample/launchers/notification-corba/src/main/java/scatours/NotificationCORBALauncher.java15
-rw-r--r--sandbox/travelsample/launchers/notification-corba/src/main/java/scatours/notification/Notification.java4
-rw-r--r--sandbox/travelsample/launchers/notification-ejb/src/main/java/scatours/NotificationEJBLauncher.java15
-rw-r--r--sandbox/travelsample/launchers/notification-ejb/src/main/java/scatours/notification/Notification.java4
-rw-r--r--sandbox/travelsample/launchers/notification-jms/src/main/java/scatours/JMSBrokerLauncher.java20
-rw-r--r--sandbox/travelsample/launchers/notification-jms/src/main/java/scatours/NotificationJMSLauncher.java17
-rw-r--r--sandbox/travelsample/launchers/notification-jms/src/main/java/scatours/notification/Notification.java4
-rw-r--r--sandbox/travelsample/launchers/notification-rmi/src/main/java/scatours/NotificationRMILauncher.java15
-rw-r--r--sandbox/travelsample/launchers/notification-rmi/src/main/java/scatours/notification/Notification.java4
-rw-r--r--sandbox/travelsample/launchers/notification-ws/src/main/java/scatours/NotificationWSLauncher.java15
-rw-r--r--sandbox/travelsample/launchers/notification-ws/src/main/java/scatours/notification/Notification.java4
-rw-r--r--sandbox/travelsample/launchers/policy/src/main/java/scatours/PolicyLauncher.java15
-rw-r--r--sandbox/travelsample/services/creditcard-payment-jaxws/src/main/java/scatours/creditcard/CreditCardServiceImpl.java5
-rw-r--r--sandbox/travelsample/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayCORBAServiceBootstrap.java20
-rw-r--r--sandbox/travelsample/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayServant.java1
-rw-r--r--sandbox/travelsample/services/smsgateway-ejb/src/main/java/scatours/smsgateway/SMSGatewayEJBServiceBootstrap.java22
-rw-r--r--sandbox/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGateway.java1
-rw-r--r--sandbox/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayImpl.java106
-rw-r--r--sandbox/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayJMSServiceBootstrap.java15
-rw-r--r--sandbox/travelsample/services/smsgateway-rmi/src/main/java/scatours/smsgateway/SMSGateway.java1
-rw-r--r--sandbox/travelsample/services/smsgateway-rmi/src/main/java/scatours/smsgateway/SMSGatewayRMIServiceBootstrap.java20
132 files changed, 1439 insertions, 1588 deletions
diff --git a/sandbox/travelsample/clients/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBAClient.java b/sandbox/travelsample/clients/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBAClient.java
index 8581c09d5f..7d799e459b 100644
--- a/sandbox/travelsample/clients/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBAClient.java
+++ b/sandbox/travelsample/clients/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBAClient.java
@@ -26,16 +26,16 @@ import com.tuscanyscatours.currencyconverter.CurrencyConverterHelper;
public class CurrencyConverterCORBAClient {
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) throws Exception {
- String[] orbArgs = {"-ORBInitialPort", "5080"};
- ORB orb = ORB.init( orbArgs, null );
+ String[] orbArgs = {"-ORBInitialPort", "5080"};
+ ORB orb = ORB.init(orbArgs, null);
- String ior = "corbaname::localhost:5080#CurrencyConverterCORBAService";
- Object obj = orb.string_to_object(ior);
- CurrencyConverter converter = CurrencyConverterHelper.narrow(obj);
+ String ior = "corbaname::localhost:5080#CurrencyConverterCORBAService";
+ Object obj = orb.string_to_object(ior);
+ CurrencyConverter converter = CurrencyConverterHelper.narrow(obj);
- System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
- System.out.println("100 USD = " + converter.convert("USD", "GBP", 100.0) + "GBP");
- }
+ System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
+ System.out.println("100 USD = " + converter.convert("USD", "GBP", 100.0) + "GBP");
+ }
}
diff --git a/sandbox/travelsample/clients/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSClient.java b/sandbox/travelsample/clients/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSClient.java
index cc4618307c..0bea38e07f 100644
--- a/sandbox/travelsample/clients/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSClient.java
+++ b/sandbox/travelsample/clients/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSClient.java
@@ -47,58 +47,57 @@ public class CurrencyConverterJMSClient {
private static OMFactory omFactory;
public static void main(String[] args) throws JMSException, XMLStreamException {
- startActiveMQSession();
-
- OMElement request = omFactory.createOMElement("convert", "http://goodvaluetrips.com/", "ns2");
- request.addChild(createArg(0, "USD"));
- request.addChild(createArg(1, "GBP"));
- request.addChild(createArg(2, "100.0"));
-
- TextMessage message = activeMQSession.createTextMessage("convert");
- message.setStringProperty("scaOperationName", "convert");
- message.setJMSReplyTo(responseDestination);
- message.setText(request.toString());
- activeMQProducer.send(message);
-
- TextMessage response = (TextMessage) consumer.receive();
- StAXOMBuilder builder = new StAXOMBuilder(
- new ByteArrayInputStream(response.getText().getBytes()));
- OMText returnElement = (OMText) builder.getDocumentElement().getFirstOMChild();
- String returnValue = returnElement.getText();
- System.out.println("100 USD = " + returnValue + "GBP");
-
- stopActiveMQSession();
+ startActiveMQSession();
+
+ OMElement request = omFactory.createOMElement("convert", "http://goodvaluetrips.com/", "ns2");
+ request.addChild(createArg(0, "USD"));
+ request.addChild(createArg(1, "GBP"));
+ request.addChild(createArg(2, "100.0"));
+
+ TextMessage message = activeMQSession.createTextMessage("convert");
+ message.setStringProperty("scaOperationName", "convert");
+ message.setJMSReplyTo(responseDestination);
+ message.setText(request.toString());
+ activeMQProducer.send(message);
+
+ TextMessage response = (TextMessage)consumer.receive();
+ StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(response.getText().getBytes()));
+ OMText returnElement = (OMText)builder.getDocumentElement().getFirstOMChild();
+ String returnValue = returnElement.getText();
+ System.out.println("100 USD = " + returnValue + "GBP");
+
+ stopActiveMQSession();
}
private static void startActiveMQSession() throws JMSException {
- ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61619");
+ ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61619");
- activeMQConnection = connectionFactory.createConnection();
- activeMQConnection.start();
+ activeMQConnection = connectionFactory.createConnection();
+ activeMQConnection.start();
- activeMQSession = activeMQConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ activeMQSession = activeMQConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- requestDestination = activeMQSession.createQueue("RequestQueue");
- activeMQProducer = activeMQSession.createProducer(requestDestination);
+ requestDestination = activeMQSession.createQueue("RequestQueue");
+ activeMQProducer = activeMQSession.createProducer(requestDestination);
- responseDestination = activeMQSession.createQueue("ResponseQueue");
- consumer = activeMQSession.createConsumer(responseDestination);
+ responseDestination = activeMQSession.createQueue("ResponseQueue");
+ consumer = activeMQSession.createConsumer(responseDestination);
- omFactory = OMAbstractFactory.getOMFactory();
+ omFactory = OMAbstractFactory.getOMFactory();
}
private static void stopActiveMQSession() throws JMSException {
consumer.close();
- activeMQProducer.close();
- activeMQSession.close();
- activeMQConnection.close();
+ activeMQProducer.close();
+ activeMQSession.close();
+ activeMQConnection.close();
}
private static OMElement createArg(int argNumber, String value) {
- OMFactory omFactory = OMAbstractFactory.getOMFactory();
- OMElement arg = omFactory.createOMElement("arg" + argNumber, null);
- OMText senderOM = omFactory.createOMText(value);
- arg.addChild(senderOM);
- return arg;
+ OMFactory omFactory = OMAbstractFactory.getOMFactory();
+ OMElement arg = omFactory.createOMElement("arg" + argNumber, null);
+ OMText senderOM = omFactory.createOMText(value);
+ arg.addChild(senderOM);
+ return arg;
}
- }
+}
diff --git a/sandbox/travelsample/clients/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java b/sandbox/travelsample/clients/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java
index 68753adc3a..e12a95c964 100644
--- a/sandbox/travelsample/clients/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java
+++ b/sandbox/travelsample/clients/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java
@@ -23,11 +23,8 @@ package com.tuscanyscatours.currencyconverter;
*/
public interface CurrencyConverter {
- double getExchangeRate(String fromCurrencyCode,
- String toCurrencyCode);
-
- double convert(String fromCurrencyCode,
- String toCurrencyCode,
- double amount);
+ double getExchangeRate(String fromCurrencyCode, String toCurrencyCode);
+
+ double convert(String fromCurrencyCode, String toCurrencyCode, double amount);
}
diff --git a/sandbox/travelsample/clients/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMIClient.java b/sandbox/travelsample/clients/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMIClient.java
index c825ecc64f..32e4fccfce 100644
--- a/sandbox/travelsample/clients/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMIClient.java
+++ b/sandbox/travelsample/clients/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMIClient.java
@@ -23,15 +23,14 @@ import java.rmi.registry.Registry;
import com.tuscanyscatours.currencyconverter.CurrencyConverter;
-
public class CurrencyConverterRMIClient {
- public static void main(String[] args) throws Exception {
- Registry registry = LocateRegistry.getRegistry("localhost", 8099);
- String name = "CurrencyConverterRMI";
- CurrencyConverter converter = (CurrencyConverter) registry.lookup(name);
+ public static void main(String[] args) throws Exception {
+ Registry registry = LocateRegistry.getRegistry("localhost", 8099);
+ String name = "CurrencyConverterRMI";
+ CurrencyConverter converter = (CurrencyConverter)registry.lookup(name);
- System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
- System.out.println("100 USD = " + converter.convert("USD", "GBP", 100.0) + "GBP");
- }
+ System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
+ System.out.println("100 USD = " + converter.convert("USD", "GBP", 100.0) + "GBP");
+ }
}
diff --git a/sandbox/travelsample/clients/currency-converter-ws-jaxws/src/main/java/scatours/CurrencyConverterWSClient.java b/sandbox/travelsample/clients/currency-converter-ws-jaxws/src/main/java/scatours/CurrencyConverterWSClient.java
index 46e2914582..ae0bae2a3e 100644
--- a/sandbox/travelsample/clients/currency-converter-ws-jaxws/src/main/java/scatours/CurrencyConverterWSClient.java
+++ b/sandbox/travelsample/clients/currency-converter-ws-jaxws/src/main/java/scatours/CurrencyConverterWSClient.java
@@ -23,11 +23,11 @@ import scatours.curencyconverter.client.CurrencyConverterService;
public class CurrencyConverterWSClient {
- public static void main(String[] args) throws Exception {
- CurrencyConverterService service = new CurrencyConverterService();
- CurrencyConverter converter = service.getPort(CurrencyConverter.class);
+ public static void main(String[] args) throws Exception {
+ CurrencyConverterService service = new CurrencyConverterService();
+ CurrencyConverter converter = service.getPort(CurrencyConverter.class);
- System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
- System.out.println("100 USD = " + converter.convert("USD", "GBP", 100.0) + "GBP");
- }
+ System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
+ System.out.println("100 USD = " + converter.convert("USD", "GBP", 100.0) + "GBP");
+ }
}
diff --git a/sandbox/travelsample/contrib/2.x/creditcard-payment-dosgi-contribution/src/main/java/scatours/payment/creditcard/impl/CreditCardPaymentImpl.java b/sandbox/travelsample/contrib/2.x/creditcard-payment-dosgi-contribution/src/main/java/scatours/payment/creditcard/impl/CreditCardPaymentImpl.java
index 6605c23bcd..d726b85f9f 100644
--- a/sandbox/travelsample/contrib/2.x/creditcard-payment-dosgi-contribution/src/main/java/scatours/payment/creditcard/impl/CreditCardPaymentImpl.java
+++ b/sandbox/travelsample/contrib/2.x/creditcard-payment-dosgi-contribution/src/main/java/scatours/payment/creditcard/impl/CreditCardPaymentImpl.java
@@ -65,7 +65,7 @@ public class CreditCardPaymentImpl implements CreditCardPayment {
return "FAILURE: Invalid Credit Card Number";
}
- return "SUCCESS: Auth Code=" + UUID.randomUUID() + " (EUR"+amount+"->USD" + charge + ")";
+ return "SUCCESS: Auth Code=" + UUID.randomUUID() + " (EUR" + amount + "->USD" + charge + ")";
}
private void print(CreditCardDetailsType creditCard) throws JAXBException, PropertyException {
diff --git a/sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/AtomBlogFeedImpl.java b/sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/AtomBlogFeedImpl.java
index edb8e17fc1..b7a392f927 100644
--- a/sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/AtomBlogFeedImpl.java
+++ b/sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/AtomBlogFeedImpl.java
@@ -33,7 +33,8 @@ import com.tuscanyscatours.blog.BlogPost;
* An Atom feed that implements the org.apache.tuscany.sca.binding.atom.collection.Collection
* interface and uses the Atom APIs to construct the Atom feed.
*/
-public class AtomBlogFeedImpl extends BaseBlogFeedImpl implements org.apache.tuscany.sca.binding.atom.collection.Collection {
+public class AtomBlogFeedImpl extends BaseBlogFeedImpl implements
+ org.apache.tuscany.sca.binding.atom.collection.Collection {
/**
* Gets an Atom feed containing all the blog posts.
diff --git a/sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/BaseBlogFeedImpl.java b/sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/BaseBlogFeedImpl.java
index 1579480dc7..f132d340ea 100644
--- a/sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/BaseBlogFeedImpl.java
+++ b/sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/BaseBlogFeedImpl.java
@@ -73,13 +73,12 @@ public abstract class BaseBlogFeedImpl {
List<BlogPost> blogEntries = new ArrayList<BlogPost>();
// Create a sample entry
- final BlogPost samplePost = new BlogPost(
- FEED_AUTHOR,
- "Apache Tuscany in Action book features SCA Tours",
- "We are famous as SCA Tours has been featured in the Apache Tuscany in Action book published by Manning",
- new Date(),
- "http://www.manning.com/laws/",
- null);
+ final BlogPost samplePost =
+ new BlogPost(
+ FEED_AUTHOR,
+ "Apache Tuscany in Action book features SCA Tours",
+ "We are famous as SCA Tours has been featured in the Apache Tuscany in Action book published by Manning",
+ new Date(), "http://www.manning.com/laws/", null);
// Add sample post to the list of posts
blogEntries.add(samplePost);
diff --git a/sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/GenericBlogFeedImpl.java b/sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/GenericBlogFeedImpl.java
index 816360d4fd..c427b658a4 100644
--- a/sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/GenericBlogFeedImpl.java
+++ b/sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/GenericBlogFeedImpl.java
@@ -59,16 +59,11 @@ public class GenericBlogFeedImpl extends BaseBlogFeedImpl {
*/
private Entry<Object, Object> convertBlogPostToFeedItem(BlogPost post) {
// Convert Blog entry into an Item
- final Item item = new Item(
- post.getTitle(),
- post.getContent(),
- post.getLink(),
- post.getRelated(),
- post.getUpdated());
+ final Item item =
+ new Item(post.getTitle(), post.getContent(), post.getLink(), post.getRelated(), post.getUpdated());
// Add item to entry
- final Entry<Object, Object> entry = new Entry<Object, Object>(
- nextBlogID(), item);
+ final Entry<Object, Object> entry = new Entry<Object, Object>(nextBlogID(), item);
return entry;
}
diff --git a/sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/RSSBlogFeedImpl.java b/sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/RSSBlogFeedImpl.java
index b4526af5d0..efccffef67 100644
--- a/sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/RSSBlogFeedImpl.java
+++ b/sandbox/travelsample/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/RSSBlogFeedImpl.java
@@ -23,20 +23,20 @@ import java.util.List;
import org.apache.tuscany.sca.binding.rss.collection.NotFoundException;
-import com.tuscanyscatours.blog.BlogPost;
-
import com.sun.syndication.feed.synd.SyndContent;
import com.sun.syndication.feed.synd.SyndContentImpl;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndEntryImpl;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.feed.synd.SyndFeedImpl;
+import com.tuscanyscatours.blog.BlogPost;
/**
* An RSS feed that implements the org.apache.tuscany.sca.binding.rss.collection.Collection
* interface and uses the RSS APIs to construct the RSS feed.
*/
-public class RSSBlogFeedImpl extends BaseBlogFeedImpl implements org.apache.tuscany.sca.binding.rss.collection.Collection {
+public class RSSBlogFeedImpl extends BaseBlogFeedImpl implements
+ org.apache.tuscany.sca.binding.rss.collection.Collection {
/**
* Gets an RSS feed containing all the blog posts.
@@ -57,7 +57,7 @@ public class RSSBlogFeedImpl extends BaseBlogFeedImpl implements org.apache.tusc
entry.setUri(nextBlogID());
entry.setAuthor(blogEntry.getAuthor());
entry.setTitle(blogEntry.getTitle());
-
+
SyndContent content = new SyndContentImpl();
content.setType("text");
content.setValue(blogEntry.getContent());
diff --git a/sandbox/travelsample/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/impl/CalendarImpl.java b/sandbox/travelsample/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/impl/CalendarImpl.java
index 27982093ff..4e6e7b161b 100644
--- a/sandbox/travelsample/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/impl/CalendarImpl.java
+++ b/sandbox/travelsample/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/impl/CalendarImpl.java
@@ -28,20 +28,20 @@ import com.tuscanyscatours.calendar.Calendar;
*/
public class CalendarImpl implements Calendar {
- public String getEndDate(String startDate, int duration){
+ public String getEndDate(String startDate, int duration) {
String returnDate = "Invalid Date";
-
+
try {
Date date = DateFormat.getInstance().parse(startDate);
java.util.Calendar calendar = java.util.Calendar.getInstance();
calendar.setTime(date);
calendar.add(java.util.Calendar.DATE, duration);
returnDate = DateFormat.getInstance().format(calendar.getTime());
- } catch (Exception ex){
+ } catch (Exception ex) {
// do nothing
System.out.println(ex.toString());
}
-
+
return returnDate;
}
}
diff --git a/sandbox/travelsample/contributions/calendar/src/test/java/scatours/calendar/CalendarTestCase.java b/sandbox/travelsample/contributions/calendar/src/test/java/scatours/calendar/CalendarTestCase.java
index 72cb5baa3c..8e0f003c4b 100644
--- a/sandbox/travelsample/contributions/calendar/src/test/java/scatours/calendar/CalendarTestCase.java
+++ b/sandbox/travelsample/contributions/calendar/src/test/java/scatours/calendar/CalendarTestCase.java
@@ -37,9 +37,10 @@ public class CalendarTestCase {
@Before
public void startNode() throws Exception {
- node = SCANodeFactory.newInstance().createSCANode("calendar.composite",
- new SCAContribution("calendar", "./target/classes"),
- new SCAContribution("calendar-test", "./target/test-classes"));
+ node =
+ SCANodeFactory.newInstance().createSCANode("calendar.composite",
+ new SCAContribution("calendar", "./target/classes"),
+ new SCAContribution("calendar-test", "./target/test-classes"));
node.start();
}
@@ -48,7 +49,7 @@ public class CalendarTestCase {
Calendar calendar = ((SCAClient)node).getService(Calendar.class, "Calendar");
System.out.println(calendar.getEndDate("07/10/96 04:05", 3));
}
-
+
@After
public void stopNode() throws Exception {
node.stop();
diff --git a/sandbox/travelsample/contributions/car/src/main/java/com/tuscanyscatours/car/impl/CarImpl.java b/sandbox/travelsample/contributions/car/src/main/java/com/tuscanyscatours/car/impl/CarImpl.java
index 23834a7909..f75c772d48 100644
--- a/sandbox/travelsample/contributions/car/src/main/java/com/tuscanyscatours/car/impl/CarImpl.java
+++ b/sandbox/travelsample/contributions/car/src/main/java/com/tuscanyscatours/car/impl/CarImpl.java
@@ -36,76 +36,56 @@ import com.tuscanyscatours.common.TripLeg;
* An implementation of the Car service
*/
@Scope("STATELESS")
-@Service(interfaces={Search.class, Book.class})
+@Service(interfaces = {Search.class, Book.class})
public class CarImpl implements Search, Book {
-
+
private List<CarInfo> cars = new ArrayList<CarInfo>();
-
+
@Callback
- protected SearchCallback searchCallback;
+ protected SearchCallback searchCallback;
@Init
public void init() {
- cars.add(new CarInfo("Premier Cars",
- "BMW 5 Series",
- "FLR",
- "06/12/09",
- "5",
- 100.00,
- "EUR",
- "http://localhost:8085/tbd" ));
- cars.add(new CarInfo("Premier Cars",
- "Ford Focus",
- "FLR",
- "06/12/09",
- "4",
- 60.00,
- "EUR",
- "http://localhost:8085/tbd" ));
+ cars.add(new CarInfo("Premier Cars", "BMW 5 Series", "FLR", "06/12/09", "5", 100.00, "EUR",
+ "http://localhost:8085/tbd"));
+ cars.add(new CarInfo("Premier Cars", "Ford Focus", "FLR", "06/12/09", "4", 60.00, "EUR",
+ "http://localhost:8085/tbd"));
}
-
+
public TripItem[] searchSynch(TripLeg tripLeg) {
List<TripItem> items = new ArrayList<TripItem>();
-
+
// find available hotels
- for(CarInfo car : cars){
- if (car.getLocation().equals(tripLeg.getToLocation())){
- TripItem item = new TripItem("",
- "",
- TripItem.CAR,
- car.getName(),
- car.getDescription(),
- car.getLocation(),
- tripLeg.getFromDate(),
- tripLeg.getToDate(),
- car.getPricePerDay(),
- car.getCurrency(),
- car.getLink());
+ for (CarInfo car : cars) {
+ if (car.getLocation().equals(tripLeg.getToLocation())) {
+ TripItem item =
+ new TripItem("", "", TripItem.CAR, car.getName(), car.getDescription(), car.getLocation(), tripLeg
+ .getFromDate(), tripLeg.getToDate(), car.getPricePerDay(), car.getCurrency(), car.getLink());
items.add(item);
}
}
-
+
return items.toArray(new TripItem[items.size()]);
}
-
+
public void searchAsynch(TripLeg tripLeg) {
- System.out.println("Starting car search");
-
- try {
- Thread.sleep(4000);
- } catch(Exception ex){
- // do nothing
+ System.out.println("Starting car search");
+
+ try {
+ Thread.sleep(4000);
+ } catch (Exception ex) {
+ // do nothing
}
-
+
// return available hotels
- searchCallback.searchResults(searchSynch(tripLeg));
+ searchCallback.searchResults(searchSynch(tripLeg));
}
-
- public int getPercentComplete(){
+
+ public int getPercentComplete() {
return 100;
}
-
+
public String book(TripItem tripItem) {
return "car1";
- }
+ }
}
diff --git a/sandbox/travelsample/contributions/car/src/main/java/com/tuscanyscatours/car/impl/CarInfo.java b/sandbox/travelsample/contributions/car/src/main/java/com/tuscanyscatours/car/impl/CarInfo.java
index 88226f4b1a..c373079ac1 100644
--- a/sandbox/travelsample/contributions/car/src/main/java/com/tuscanyscatours/car/impl/CarInfo.java
+++ b/sandbox/travelsample/contributions/car/src/main/java/com/tuscanyscatours/car/impl/CarInfo.java
@@ -19,9 +19,8 @@
package com.tuscanyscatours.car.impl;
-
public class CarInfo {
-
+
private String name;
private String description;
private String location;
@@ -30,18 +29,18 @@ public class CarInfo {
private double pricePerDay;
private String currency;
private String link;
-
+
public CarInfo() {
- }
-
- public CarInfo(String name,
- String description,
- String location,
- String date,
- String seats,
- double pricePerDay,
- String currency,
- String link) {
+ }
+
+ public CarInfo(String name,
+ String description,
+ String location,
+ String date,
+ String seats,
+ double pricePerDay,
+ String currency,
+ String link) {
this.name = name;
this.description = description;
@@ -51,69 +50,68 @@ public class CarInfo {
this.pricePerDay = pricePerDay;
this.currency = currency;
this.link = link;
- }
-
-
+ }
+
public String getName() {
return name;
}
-
+
public void setName(String name) {
this.name = name;
- }
-
+ }
+
public String getDescription() {
return description;
}
-
+
public void setDescription(String description) {
- this.description = description;
- }
-
+ this.description = description;
+ }
+
public String getLocation() {
return location;
}
-
+
public void setLocation(String location) {
this.location = location;
}
-
+
public String getDate() {
return date;
}
-
+
public void setDate(String date) {
this.date = date;
}
-
+
public String getSeats() {
return seats;
- }
-
+ }
+
public void setSeats(String seats) {
this.seats = seats;
}
-
+
public double getPricePerDay() {
return pricePerDay;
}
-
+
public void setPricePerDay(double pricePerDay) {
this.pricePerDay = pricePerDay;
}
-
+
public String getCurrency() {
return currency;
}
-
+
public void setCurrency(String currency) {
this.currency = currency;
}
-
+
public String getLink() {
return link;
}
-
+
public void setLink(String link) {
this.link = link;
}
diff --git a/sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/Search.java b/sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/Search.java
index b8af6ba93f..db0377a779 100644
--- a/sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/Search.java
+++ b/sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/Search.java
@@ -29,9 +29,9 @@ import org.osoa.sca.annotations.Remotable;
@Callback(SearchCallback.class)
public interface Search {
TripItem[] searchSynch(TripLeg tripLeg);
-
+
@OneWay
void searchAsynch(TripLeg tripLeg);
-
+
int getPercentComplete();
}
diff --git a/sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/SearchCallback.java b/sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/SearchCallback.java
index fea43c6261..ddab27c3dd 100644
--- a/sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/SearchCallback.java
+++ b/sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/SearchCallback.java
@@ -28,5 +28,6 @@ import org.osoa.sca.annotations.Remotable;
public interface SearchCallback {
@EndsConversation
void searchResults(TripItem[] items);
+
void setPercentComplete(String searchComponent, int percentComplete);
}
diff --git a/sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/TripItem.java b/sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/TripItem.java
index 3458cd9d27..2f2a6299f9 100644
--- a/sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/TripItem.java
+++ b/sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/TripItem.java
@@ -19,16 +19,14 @@
package com.tuscanyscatours.common;
-
-
public class TripItem {
-
+
public static String FLIGHT = "Flight";
public static String HOTEL = "Hotel";
public static String CAR = "Car";
public static String TRIP = "Trip";
-
- private String id;
+
+ private String id;
private String tripId;
private String type;
private String name;
@@ -43,10 +41,10 @@ public class TripItem {
private String customerDetails;
private String agentDetails;
private String bookingCode;
-
+
public TripItem() {
- }
-
+ }
+
public TripItem(TripItem item) {
this.id = item.getId();
this.tripId = item.getTripId();
@@ -59,18 +57,18 @@ public class TripItem {
this.price = item.getPrice();
this.currency = item.getCurrency();
this.link = item.getLink();
- }
-
- public TripItem(String id,
+ }
+
+ public TripItem(String id,
String tripId,
- String type,
- String name,
- String description,
- String location,
- String fromDate,
- String toDate,
- double price,
- String currency,
+ String type,
+ String name,
+ String description,
+ String location,
+ String fromDate,
+ String toDate,
+ double price,
+ String currency,
String link) {
this.id = id;
this.tripId = tripId;
@@ -83,148 +81,158 @@ public class TripItem {
this.price = price;
this.currency = currency;
this.link = link;
- }
-
+ }
+
public String getId() {
return id;
}
-
+
public void setId(String id) {
this.id = id;
}
-
+
public String getTripId() {
return tripId;
}
-
+
public void setTripId(String tripId) {
this.tripId = tripId;
}
-
+
public String getType() {
return type;
}
-
+
public void setType(String type) {
this.type = type;
}
-
+
public String getName() {
return name;
}
-
+
public void setName(String name) {
this.name = name;
- }
-
+ }
+
public String getDescription() {
return description;
}
-
+
public void setDescription(String description) {
- this.description = description;
- }
-
+ this.description = description;
+ }
+
public String getLocation() {
return location;
- }
-
+ }
+
public void setLocation(String location) {
this.location = location;
}
-
+
public String getFromDate() {
return fromDate;
}
-
+
public void setFromDate(String fromDate) {
this.fromDate = fromDate;
}
-
+
public String getToDate() {
return toDate;
}
-
+
public void setToDate(String toDate) {
this.toDate = toDate;
}
-
+
public double getPrice() {
return price;
}
-
+
public void setPrice(double price) {
this.price = price;
}
-
+
public String getCurrency() {
return currency;
}
-
+
public void setCurrency(String currency) {
this.currency = currency;
}
-
+
public String getLink() {
return link;
}
-
+
public void setLink(String link) {
this.link = link;
}
-
+
public TripItem[] getTripItems() {
return tripItems;
}
-
+
public void setTripItems(TripItem[] tripItems) {
this.tripItems = tripItems;
}
-
+
public String getCustomerDetails() {
return customerDetails;
}
-
+
public void setCustomerDetails(String customerDetails) {
this.customerDetails = customerDetails;
}
-
+
public String getAgentDetails() {
return agentDetails;
}
-
+
public void setAgentDetails(String agentDetails) {
this.agentDetails = agentDetails;
}
-
+
public String getBookingCode() {
return bookingCode;
}
-
+
public void setBookingCode(String bookingCode) {
this.bookingCode = bookingCode;
}
-
+
@Override
- public String toString(){
- String tripString = "Trip: id " + this.tripId +
- " type " + this.type +
- " name " + this.name +
- " description " + this.description +
- " location " + this.location +
- " fromDate " + this.fromDate +
- " toDate " + this.toDate +
- " price " + this.price +
- " currency " + this.currency +
- " link " + this.link;
+ public String toString() {
+ String tripString =
+ "Trip: id " + this.tripId
+ + " type "
+ + this.type
+ + " name "
+ + this.name
+ + " description "
+ + this.description
+ + " location "
+ + this.location
+ + " fromDate "
+ + this.fromDate
+ + " toDate "
+ + this.toDate
+ + " price "
+ + this.price
+ + " currency "
+ + this.currency
+ + " link "
+ + this.link;
return tripString;
}
-
+
@Override
public boolean equals(Object obj) {
-
- if (obj instanceof TripItem){
- if (((TripItem)obj).getId().equals(getId())){
+
+ if (obj instanceof TripItem) {
+ if (((TripItem)obj).getId().equals(getId())) {
return true;
}
}
diff --git a/sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/TripLeg.java b/sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/TripLeg.java
index ea549da52f..663634b1e9 100644
--- a/sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/TripLeg.java
+++ b/sandbox/travelsample/contributions/common/src/main/java/com/tuscanyscatours/common/TripLeg.java
@@ -19,9 +19,8 @@
package com.tuscanyscatours.common;
-
public class TripLeg {
-
+
private String id;
private String fromLocation;
private String toLocation;
@@ -29,69 +28,58 @@ public class TripLeg {
private String toDate;
private String noOfPeople;
-
public TripLeg() {
}
-
- public TripLeg(String id,
- String fromLocation,
- String toLocation,
- String fromDate,
- String toDate,
- String noOfPeople) {
- }
-
+
+ public TripLeg(String id, String fromLocation, String toLocation, String fromDate, String toDate, String noOfPeople) {
+ }
+
public String getId() {
return id;
}
-
+
public void setId(String id) {
this.id = id;
- }
-
+ }
+
public String getFromLocation() {
return fromLocation;
}
-
+
public void setFromLocation(String fromLocation) {
this.fromLocation = fromLocation;
}
-
+
public String getToLocation() {
return toLocation;
}
-
+
public void setToLocation(String toLocation) {
this.toLocation = toLocation;
- }
-
+ }
+
public String getFromDate() {
return fromDate;
}
-
+
public void setFromDate(String fromDate) {
this.fromDate = fromDate;
}
-
+
public String getToDate() {
return toDate;
}
-
+
public void setToDate(String toDate) {
this.toDate = toDate;
- }
+ }
public String getNoOfPeople() {
return noOfPeople;
}
-
+
public void setNoOfPeople(String noOfPeople) {
this.noOfPeople = noOfPeople;
}
-
-
-
-
-
}
diff --git a/sandbox/travelsample/contributions/creditcard-payment-jaxb-policy/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java b/sandbox/travelsample/contributions/creditcard-payment-jaxb-policy/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java
index 253fcbe674..293f08453f 100644
--- a/sandbox/travelsample/contributions/creditcard-payment-jaxb-policy/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java
+++ b/sandbox/travelsample/contributions/creditcard-payment-jaxb-policy/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java
@@ -19,28 +19,28 @@
package com.tuscanyscatours.payment.creditcard.impl;
+import org.osoa.sca.annotations.Service;
+
import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType;
import com.tuscanyscatours.payment.creditcard.CreditCardPayment;
-import org.osoa.sca.annotations.Service;
/**
*
*/
@Service(CreditCardPayment.class)
public class CreditCardPaymentImpl implements CreditCardPayment {
-
+
public String authorize(CreditCardDetailsType creditCard, float amount) {
- if (creditCard != null){
- System.out.println("Checking card: name = " +
- creditCard.getCardOwner().getName() +
- " number = " +
- creditCard.getCreditCardNumber() +
- " for amount " +
- amount);
+ if (creditCard != null) {
+ System.out.println("Checking card: name = " + creditCard.getCardOwner().getName()
+ + " number = "
+ + creditCard.getCreditCardNumber()
+ + " for amount "
+ + amount);
} else {
System.out.println("Checking card is null");
}
-
+
return "OK";
}
}
diff --git a/sandbox/travelsample/contributions/creditcard-payment-jaxb-policy/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java b/sandbox/travelsample/contributions/creditcard-payment-jaxb-policy/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java
index fb989ae897..7f40910d82 100644
--- a/sandbox/travelsample/contributions/creditcard-payment-jaxb-policy/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java
+++ b/sandbox/travelsample/contributions/creditcard-payment-jaxb-policy/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java
@@ -19,13 +19,6 @@
package scatours.payment.creditcard;
-import com.tuscanyscatours.payment.creditcard.AuthorizeFault_Exception;
-import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType;
-import com.tuscanyscatours.payment.creditcard.CreditCardPayment;
-import com.tuscanyscatours.payment.creditcard.CreditCardTypeType;
-import com.tuscanyscatours.payment.creditcard.ObjectFactory;
-import com.tuscanyscatours.payment.creditcard.PayerType;
-
import org.apache.tuscany.sca.node.SCAClient;
import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode;
@@ -35,6 +28,13 @@ import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
+import com.tuscanyscatours.payment.creditcard.AuthorizeFault_Exception;
+import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType;
+import com.tuscanyscatours.payment.creditcard.CreditCardPayment;
+import com.tuscanyscatours.payment.creditcard.CreditCardTypeType;
+import com.tuscanyscatours.payment.creditcard.ObjectFactory;
+import com.tuscanyscatours.payment.creditcard.PayerType;
+
/**
*
*/
@@ -46,19 +46,19 @@ public class CreditCardPaymentTestCase {
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
- try {
- node = SCANodeFactory.newInstance().createSCANode(null,
- new SCAContribution("creditcard", "./target/classes"));
+ try {
+ node =
+ SCANodeFactory.newInstance().createSCANode(null, new SCAContribution("creditcard", "./target/classes"));
- node.start();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
+ node.start();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
}
@Test
public void testCreditCardPayment() {
- SCAClient client = (SCAClient) node;
+ SCAClient client = (SCAClient)node;
CreditCardPayment cc = client.getService(CreditCardPayment.class, "CreditCardPayment");
ObjectFactory objectFactory = new ObjectFactory();
diff --git a/sandbox/travelsample/contributions/creditcard-payment-jaxb/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java b/sandbox/travelsample/contributions/creditcard-payment-jaxb/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java
index b9227b1752..ed817a58bb 100644
--- a/sandbox/travelsample/contributions/creditcard-payment-jaxb/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java
+++ b/sandbox/travelsample/contributions/creditcard-payment-jaxb/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java
@@ -19,28 +19,28 @@
package com.tuscanyscatours.payment.creditcard.impl;
+import org.osoa.sca.annotations.Service;
+
import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType;
import com.tuscanyscatours.payment.creditcard.CreditCardPayment;
-import org.osoa.sca.annotations.Service;
/**
*
*/
@Service(CreditCardPayment.class)
public class CreditCardPaymentImpl implements CreditCardPayment {
-
+
public String authorize(CreditCardDetailsType creditCard, float amount) {
- if (creditCard != null){
- System.out.println("Checking card: name = " +
- creditCard.getCardOwner().getName() +
- " number = " +
- creditCard.getCreditCardNumber() +
- " for amount " +
- amount);
+ if (creditCard != null) {
+ System.out.println("Checking card: name = " + creditCard.getCardOwner().getName()
+ + " number = "
+ + creditCard.getCreditCardNumber()
+ + " for amount "
+ + amount);
} else {
System.out.println("Checking card is null");
}
-
+
return "OK";
}
}
diff --git a/sandbox/travelsample/contributions/creditcard-payment-jaxb/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java b/sandbox/travelsample/contributions/creditcard-payment-jaxb/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java
index 2bb8b3b35c..65c7beb367 100644
--- a/sandbox/travelsample/contributions/creditcard-payment-jaxb/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java
+++ b/sandbox/travelsample/contributions/creditcard-payment-jaxb/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java
@@ -19,13 +19,6 @@
package scatours.payment.creditcard;
-import com.tuscanyscatours.payment.creditcard.AuthorizeFault_Exception;
-import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType;
-import com.tuscanyscatours.payment.creditcard.CreditCardPayment;
-import com.tuscanyscatours.payment.creditcard.CreditCardTypeType;
-import com.tuscanyscatours.payment.creditcard.ObjectFactory;
-import com.tuscanyscatours.payment.creditcard.PayerType;
-
import org.apache.tuscany.sca.node.SCAClient;
import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode;
@@ -35,6 +28,13 @@ import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
+import com.tuscanyscatours.payment.creditcard.AuthorizeFault_Exception;
+import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType;
+import com.tuscanyscatours.payment.creditcard.CreditCardPayment;
+import com.tuscanyscatours.payment.creditcard.CreditCardTypeType;
+import com.tuscanyscatours.payment.creditcard.ObjectFactory;
+import com.tuscanyscatours.payment.creditcard.PayerType;
+
/**
*
*/
@@ -46,19 +46,19 @@ public class CreditCardPaymentTestCase {
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
- try {
- node = SCANodeFactory.newInstance().createSCANode(null,
- new SCAContribution("creditcard", "./target/classes"));
+ try {
+ node =
+ SCANodeFactory.newInstance().createSCANode(null, new SCAContribution("creditcard", "./target/classes"));
- node.start();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
+ node.start();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
}
@Test
public void testCreditCardPayment() {
- SCAClient client = (SCAClient) node;
+ SCAClient client = (SCAClient)node;
CreditCardPayment cc = client.getService(CreditCardPayment.class, "CreditCardPayment");
ObjectFactory objectFactory = new ObjectFactory();
diff --git a/sandbox/travelsample/contributions/creditcard-payment-sdo/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardPayment.java b/sandbox/travelsample/contributions/creditcard-payment-sdo/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardPayment.java
index 2eaf9eb028..9f508ecc59 100644
--- a/sandbox/travelsample/contributions/creditcard-payment-sdo/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardPayment.java
+++ b/sandbox/travelsample/contributions/creditcard-payment-sdo/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardPayment.java
@@ -1,4 +1,3 @@
-
package com.tuscanyscatours.payment.creditcard;
import javax.jws.WebMethod;
@@ -8,7 +7,6 @@ import javax.jws.WebService;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
-
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.1.3-b02-
@@ -18,7 +16,6 @@ import javax.xml.ws.ResponseWrapper;
@WebService(name = "CreditCardPayment", targetNamespace = "http://tuscanyscatours.com/CreditCardPayment/")
public interface CreditCardPayment {
-
/**
*
* @param amount
@@ -30,10 +27,7 @@ public interface CreditCardPayment {
@WebResult(name = "Status", targetNamespace = "")
@RequestWrapper(localName = "authorize", targetNamespace = "http://tuscanyscatours.com/CreditCardPayment/", className = "com.tuscanyscatours.payment.creditcard.AuthorizeType")
@ResponseWrapper(localName = "authorizeResponse", targetNamespace = "http://tuscanyscatours.com/CreditCardPayment/", className = "com.tuscanyscatours.payment.creditcard.AuthorizeResponseType")
- public String authorize(
- @WebParam(name = "CreditCard", targetNamespace = "")
- CreditCardDetailsType creditCard,
- @WebParam(name = "Amount", targetNamespace = "")
- float amount);
+ public String authorize(@WebParam(name = "CreditCard", targetNamespace = "") CreditCardDetailsType creditCard,
+ @WebParam(name = "Amount", targetNamespace = "") float amount);
}
diff --git a/sandbox/travelsample/contributions/creditcard-payment-sdo/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java b/sandbox/travelsample/contributions/creditcard-payment-sdo/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java
index 681f9af7e2..ed817a58bb 100644
--- a/sandbox/travelsample/contributions/creditcard-payment-sdo/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java
+++ b/sandbox/travelsample/contributions/creditcard-payment-sdo/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java
@@ -29,19 +29,18 @@ import com.tuscanyscatours.payment.creditcard.CreditCardPayment;
*/
@Service(CreditCardPayment.class)
public class CreditCardPaymentImpl implements CreditCardPayment {
-
+
public String authorize(CreditCardDetailsType creditCard, float amount) {
- if (creditCard != null){
- System.out.println("Checking card: name = " +
- creditCard.getCardOwner().getName() +
- " number = " +
- creditCard.getCreditCardNumber() +
- " for amount " +
- amount);
+ if (creditCard != null) {
+ System.out.println("Checking card: name = " + creditCard.getCardOwner().getName()
+ + " number = "
+ + creditCard.getCreditCardNumber()
+ + " for amount "
+ + amount);
} else {
System.out.println("Checking card is null");
}
-
+
return "OK";
}
}
diff --git a/sandbox/travelsample/contributions/creditcard-payment-sdo/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java b/sandbox/travelsample/contributions/creditcard-payment-sdo/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java
index 802626594b..b7d76a061f 100644
--- a/sandbox/travelsample/contributions/creditcard-payment-sdo/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java
+++ b/sandbox/travelsample/contributions/creditcard-payment-sdo/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java
@@ -19,19 +19,19 @@
package scatours.payment.creditcard;
-import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType;
-import com.tuscanyscatours.payment.creditcard.CreditCardPayment;
-import com.tuscanyscatours.payment.creditcard.CreditCardPaymentFactory;
-import com.tuscanyscatours.payment.creditcard.PayerType;
import org.apache.tuscany.sca.node.SCAClient;
import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode;
import org.apache.tuscany.sca.node.SCANodeFactory;
import org.junit.AfterClass;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
+import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType;
+import com.tuscanyscatours.payment.creditcard.CreditCardPayment;
+import com.tuscanyscatours.payment.creditcard.CreditCardPaymentFactory;
+import com.tuscanyscatours.payment.creditcard.PayerType;
+
/**
*
*/
@@ -44,16 +44,15 @@ public class CreditCardPaymentTestCase {
@BeforeClass
public static void setUpBeforeClass() throws Exception {
SCANodeFactory factory = SCANodeFactory.newInstance();
- node = factory.createSCANode(null,
- new SCAContribution("creditcard-sdo", "./target/classes"));
+ node = factory.createSCANode(null, new SCAContribution("creditcard-sdo", "./target/classes"));
node.start();
}
-
+
@Test
public void testCreditCardPayment() {
- SCAClient client = (SCAClient) node;
+ SCAClient client = (SCAClient)node;
CreditCardPayment cc = client.getService(CreditCardPayment.class, "CreditCardPayment");
-
+
CreditCardPaymentFactory factory = CreditCardPaymentFactory.INSTANCE;
CreditCardDetailsType ccDetails = factory.createCreditCardDetailsType();
ccDetails.setCreditCardType("Visa");
@@ -63,7 +62,7 @@ public class CreditCardPaymentTestCase {
PayerType ccOwner = factory.createPayerType();
ccOwner.setName("Fred");
ccDetails.setCardOwner(ccOwner);
-
+
System.out.println(cc.authorize(ccDetails, 100.00f));
}
diff --git a/sandbox/travelsample/contributions/currency-servlet/src/main/java/com/tuscanyscatours/currencyconverter/servlet/CurrencyConverterServlet.java b/sandbox/travelsample/contributions/currency-servlet/src/main/java/com/tuscanyscatours/currencyconverter/servlet/CurrencyConverterServlet.java
index 37987b29e7..a4b929b65d 100644
--- a/sandbox/travelsample/contributions/currency-servlet/src/main/java/com/tuscanyscatours/currencyconverter/servlet/CurrencyConverterServlet.java
+++ b/sandbox/travelsample/contributions/currency-servlet/src/main/java/com/tuscanyscatours/currencyconverter/servlet/CurrencyConverterServlet.java
@@ -42,8 +42,8 @@ public class CurrencyConverterServlet extends HttpServlet {
// The Currency Converter reference will only be injected from the @Reference
// annotation in containers supporting SCA "deep" integration. In other
// environments in can be looked up from the ComponentContext.
- ComponentContext context = (ComponentContext) config.getServletContext()
- .getAttribute("org.osoa.sca.ComponentContext");
+ ComponentContext context =
+ (ComponentContext)config.getServletContext().getAttribute("org.osoa.sca.ComponentContext");
currencyConverter = context.getService(CurrencyConverter.class, "currencyConverter");
}
}
@@ -60,11 +60,11 @@ public class CurrencyConverterServlet extends HttpServlet {
out.write("</form><p>");
String dollarsStr = request.getParameter("dollars");
- if ( dollarsStr != null) {
- double dollars = Double.parseDouble(dollarsStr);
- double converted = currencyConverter.convert("USD", "GBP", dollars);
- out.write(dollars + " US Dollars = " + converted + " GB Pounds");
- }
+ if (dollarsStr != null) {
+ double dollars = Double.parseDouble(dollarsStr);
+ double converted = currencyConverter.convert("USD", "GBP", dollars);
+ out.write(dollars + " US Dollars = " + converted + " GB Pounds");
+ }
out.write("</body></html>");
out.write("</body></html>");
diff --git a/sandbox/travelsample/contributions/currency/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java b/sandbox/travelsample/contributions/currency/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java
index 24d945b2f4..b1f783bfba 100644
--- a/sandbox/travelsample/contributions/currency/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java
+++ b/sandbox/travelsample/contributions/currency/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java
@@ -26,11 +26,8 @@ import org.osoa.sca.annotations.Remotable;
@Remotable
public interface CurrencyConverter {
- double getExchangeRate(String fromCurrencyCode,
- String toCurrencyCode);
-
- double convert(String fromCurrencyCode,
- String toCurrencyCode,
- double amount);
+ double getExchangeRate(String fromCurrencyCode, String toCurrencyCode);
+
+ double convert(String fromCurrencyCode, String toCurrencyCode, double amount);
}
diff --git a/sandbox/travelsample/contributions/currency/src/main/java/com/tuscanyscatours/currencyconverter/impl/CurrencyConverterImpl.java b/sandbox/travelsample/contributions/currency/src/main/java/com/tuscanyscatours/currencyconverter/impl/CurrencyConverterImpl.java
index 13519a4969..6ad9a957c7 100644
--- a/sandbox/travelsample/contributions/currency/src/main/java/com/tuscanyscatours/currencyconverter/impl/CurrencyConverterImpl.java
+++ b/sandbox/travelsample/contributions/currency/src/main/java/com/tuscanyscatours/currencyconverter/impl/CurrencyConverterImpl.java
@@ -21,35 +21,33 @@ package com.tuscanyscatours.currencyconverter.impl;
import java.util.HashMap;
import java.util.Map;
-import com.tuscanyscatours.currencyconverter.CurrencyConverter;
import org.osoa.sca.annotations.Service;
+import com.tuscanyscatours.currencyconverter.CurrencyConverter;
+
/**
* An implementation of the CurrencyConverter service
*/
-@Service(interfaces={CurrencyConverter.class})
+@Service(interfaces = {CurrencyConverter.class})
public class CurrencyConverterImpl implements CurrencyConverter {
-
+
// currency index
private Map<String, Integer> currencyIndex = new HashMap<String, Integer>();
-
+
// exchange rates
- private final double rates [][] = {{ 1.00, 0.50, 0.66 },
- { 2.00, 1.00, 1.33 },
- { 1.50, 0.75, 1.00 } } ;
-
- public CurrencyConverterImpl(){
+ private final double rates[][] = { {1.00, 0.50, 0.66}, {2.00, 1.00, 1.33}, {1.50, 0.75, 1.00}};
+
+ public CurrencyConverterImpl() {
currencyIndex.put("USD", new Integer(0));
currencyIndex.put("GBP", new Integer(1));
currencyIndex.put("EUR", new Integer(2));
}
- public double getExchangeRate(String fromCurrencyCode, String toCurrencyCode){
- return rates[currencyIndex.get(fromCurrencyCode).intValue()]
- [currencyIndex.get(toCurrencyCode).intValue()];
- }
+ public double getExchangeRate(String fromCurrencyCode, String toCurrencyCode) {
+ return rates[currencyIndex.get(fromCurrencyCode).intValue()][currencyIndex.get(toCurrencyCode).intValue()];
+ }
- public double convert(String fromCurrencyCode, String toCurrencyCode, double amount){
+ public double convert(String fromCurrencyCode, String toCurrencyCode, double amount) {
return amount * getExchangeRate(fromCurrencyCode, toCurrencyCode);
}
}
diff --git a/sandbox/travelsample/contributions/databinding-client/src/main/java/scatours/client/TestClient.java b/sandbox/travelsample/contributions/databinding-client/src/main/java/scatours/client/TestClient.java
index 8f69ce9d5f..f598a6f056 100644
--- a/sandbox/travelsample/contributions/databinding-client/src/main/java/scatours/client/TestClient.java
+++ b/sandbox/travelsample/contributions/databinding-client/src/main/java/scatours/client/TestClient.java
@@ -19,8 +19,6 @@
package scatours.client;
-import java.math.BigDecimal;
-
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
@@ -35,7 +33,7 @@ public class TestClient {
}
public void run() {
- System.out.println("Call Payment component");
+ System.out.println("Call Payment component");
System.out.println(payment.makePaymentMember("c-0", 100.00f));
System.out.println(payment.makePaymentMember("c-1", 100.00f));
}
diff --git a/sandbox/travelsample/contributions/emailgateway/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java b/sandbox/travelsample/contributions/emailgateway/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java
index 3f561bfe70..0ff12b4efa 100644
--- a/sandbox/travelsample/contributions/emailgateway/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java
+++ b/sandbox/travelsample/contributions/emailgateway/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java
@@ -19,9 +19,10 @@
package com.tuscanyscatours.emailgateway.impl;
+import org.osoa.sca.annotations.Service;
+
import com.tuscanyscatours.emailgateway.EmailGateway;
import com.tuscanyscatours.emailgateway.EmailType;
-import org.osoa.sca.annotations.Service;
/**
*
diff --git a/sandbox/travelsample/contributions/emailgateway/src/test/java/scatours/emailgateway/EmailGatewayTestCase.java b/sandbox/travelsample/contributions/emailgateway/src/test/java/scatours/emailgateway/EmailGatewayTestCase.java
index 9d16b30cab..e820d30915 100644
--- a/sandbox/travelsample/contributions/emailgateway/src/test/java/scatours/emailgateway/EmailGatewayTestCase.java
+++ b/sandbox/travelsample/contributions/emailgateway/src/test/java/scatours/emailgateway/EmailGatewayTestCase.java
@@ -19,9 +19,6 @@
package scatours.emailgateway;
-import com.tuscanyscatours.emailgateway.EmailGateway;
-import com.tuscanyscatours.emailgateway.EmailType;
-import com.tuscanyscatours.emailgateway.ObjectFactory;
import org.apache.tuscany.sca.node.SCAClient;
import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode;
@@ -30,6 +27,10 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import com.tuscanyscatours.emailgateway.EmailGateway;
+import com.tuscanyscatours.emailgateway.EmailType;
+import com.tuscanyscatours.emailgateway.ObjectFactory;
+
/**
*
*/
@@ -42,15 +43,16 @@ public class EmailGatewayTestCase {
@BeforeClass
public static void setUpBeforeClass() throws Exception {
SCANodeFactory factory = SCANodeFactory.newInstance();
- node = factory.createSCANode("emailgateway.composite",
- new SCAContribution("emailgateway", "./target/classes"),
- new SCAContribution("emailgateway-test", "./target/test-classes"));
+ node =
+ factory.createSCANode("emailgateway.composite",
+ new SCAContribution("emailgateway", "./target/classes"),
+ new SCAContribution("emailgateway-test", "./target/test-classes"));
node.start();
}
-
+
@Test
public void testEmailGateway() {
- SCAClient client = (SCAClient) node;
+ SCAClient client = (SCAClient)node;
EmailGateway cc = client.getService(EmailGateway.class, "EmailGatewayClient");
ObjectFactory objectFactory = new ObjectFactory();
EmailType email = objectFactory.createEmailType();
@@ -59,7 +61,7 @@ public class EmailGatewayTestCase {
email.setBody("A message");
System.out.println(cc.sendEmail(email));
}
-
+
/**
* @throws java.lang.Exception
*/
diff --git a/sandbox/travelsample/contributions/feed-logger/src/main/java/com/tuscanyscatours/feedlogger/impl/FeedLoggerImpl.java b/sandbox/travelsample/contributions/feed-logger/src/main/java/com/tuscanyscatours/feedlogger/impl/FeedLoggerImpl.java
index 7f1e25a828..a949d63383 100644
--- a/sandbox/travelsample/contributions/feed-logger/src/main/java/com/tuscanyscatours/feedlogger/impl/FeedLoggerImpl.java
+++ b/sandbox/travelsample/contributions/feed-logger/src/main/java/com/tuscanyscatours/feedlogger/impl/FeedLoggerImpl.java
@@ -21,14 +21,13 @@ package com.tuscanyscatours.feedlogger.impl;
import java.util.List;
-import com.tuscanyscatours.feedlogger.FeedLogger;
-
import org.apache.abdera.model.Entry;
import org.apache.abdera.model.Feed;
import org.osoa.sca.annotations.Reference;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
+import com.tuscanyscatours.feedlogger.FeedLogger;
public class FeedLoggerImpl implements FeedLogger {
@@ -89,7 +88,7 @@ public class FeedLoggerImpl implements FeedLogger {
private void logRSSFeed(org.apache.tuscany.sca.binding.rss.collection.Collection rssFeed, int maxEntries) {
SyndFeed feed = rssFeed.getFeed();
System.out.println("Feed: " + feed.getTitle());
-
+
List<SyndEntry> entries = feed.getEntries();
for (int i = 0; i < entries.size() && i < maxEntries; i++) {
SyndEntry entry = entries.get(i);
diff --git a/sandbox/travelsample/contributions/flight/src/main/java/com/tuscanyscatours/flight/impl/FlightImpl.java b/sandbox/travelsample/contributions/flight/src/main/java/com/tuscanyscatours/flight/impl/FlightImpl.java
index cd7830e321..36407de5b3 100644
--- a/sandbox/travelsample/contributions/flight/src/main/java/com/tuscanyscatours/flight/impl/FlightImpl.java
+++ b/sandbox/travelsample/contributions/flight/src/main/java/com/tuscanyscatours/flight/impl/FlightImpl.java
@@ -24,7 +24,6 @@ import java.util.List;
import org.osoa.sca.annotations.Callback;
import org.osoa.sca.annotations.ComponentName;
import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Property;
import org.osoa.sca.annotations.Scope;
import org.osoa.sca.annotations.Service;
@@ -38,14 +37,14 @@ import com.tuscanyscatours.common.TripLeg;
* An implementation of the Flight service
*/
@Scope("CONVERSATION")
-@Service(interfaces={Search.class, Book.class})
+@Service(interfaces = {Search.class, Book.class})
public class FlightImpl implements Search, Book {
-
+
private List<FlightInfo> flights = new ArrayList<FlightInfo>();
-
+
@Callback
- protected SearchCallback searchCallback;
-
+ protected SearchCallback searchCallback;
+
@ComponentName
protected String componentName;
@@ -53,97 +52,69 @@ public class FlightImpl implements Search, Book {
@Init
public void init() {
- flights.add(new FlightInfo("EA26",
- "Europe Airlines Airbus A300",
- "LGW",
- "FLR",
- "06/12/09",
- "06/12/09",
- "350",
- 250,
- "EUR",
- "http://localhost:8085/tbd" ));
- flights.add(new FlightInfo("EA27",
- "Europe Airlines Airbus A300",
- "FLR",
- "LGW",
- "13/12/09",
- "13/12/09",
- "350",
- 250,
- "EUR",
- "http://localhost:8085/tbd" ));
+ flights.add(new FlightInfo("EA26", "Europe Airlines Airbus A300", "LGW", "FLR", "06/12/09", "06/12/09", "350",
+ 250, "EUR", "http://localhost:8085/tbd"));
+ flights.add(new FlightInfo("EA27", "Europe Airlines Airbus A300", "FLR", "LGW", "13/12/09", "13/12/09", "350",
+ 250, "EUR", "http://localhost:8085/tbd"));
}
-
+
public TripItem[] searchSynch(TripLeg tripLeg) {
List<TripItem> items = new ArrayList<TripItem>();
-
+
// find outbound leg
- for(FlightInfo flight : flights){
- if ((flight.getFromLocation().equals(tripLeg.getFromLocation())) &&
- (flight.getToLocation().equals(tripLeg.getToLocation())) &&
- (flight.getFromDate().equals(tripLeg.getFromDate()))){
- TripItem item = new TripItem("",
- "",
- TripItem.FLIGHT,
- flight.getName(),
- flight.getDescription(),
- flight.getFromLocation() + " - " + flight.getToLocation(),
- flight.getFromDate(),
- flight.getToDate(),
- flight.getPricePerSeat(),
- flight.getCurrency(),
- flight.getLink());
+ for (FlightInfo flight : flights) {
+ if ((flight.getFromLocation().equals(tripLeg.getFromLocation())) && (flight.getToLocation().equals(tripLeg
+ .getToLocation()))
+ && (flight.getFromDate().equals(tripLeg.getFromDate()))) {
+ TripItem item =
+ new TripItem("", "", TripItem.FLIGHT, flight.getName(), flight.getDescription(), flight
+ .getFromLocation() + " - "
+ + flight.getToLocation(), flight.getFromDate(), flight.getToDate(), flight.getPricePerSeat(),
+ flight.getCurrency(), flight.getLink());
items.add(item);
}
}
-
+
// find return leg
- for(FlightInfo flight : flights){
- if ((flight.getFromLocation().equals(tripLeg.getToLocation())) &&
- (flight.getToLocation().equals(tripLeg.getFromLocation())) &&
- (flight.getFromDate().equals(tripLeg.getToDate()))){
- TripItem item = new TripItem("",
- "",
- TripItem.FLIGHT,
- flight.getName(),
- flight.getDescription(),
- flight.getFromLocation() + " - " + flight.getToLocation(),
- flight.getFromDate(),
- tripLeg.getToDate(),
- flight.getPricePerSeat(),
- flight.getCurrency(),
- flight.getLink());
+ for (FlightInfo flight : flights) {
+ if ((flight.getFromLocation().equals(tripLeg.getToLocation())) && (flight.getToLocation().equals(tripLeg
+ .getFromLocation()))
+ && (flight.getFromDate().equals(tripLeg.getToDate()))) {
+ TripItem item =
+ new TripItem("", "", TripItem.FLIGHT, flight.getName(), flight.getDescription(), flight
+ .getFromLocation() + " - "
+ + flight.getToLocation(), flight.getFromDate(), tripLeg.getToDate(), flight.getPricePerSeat(),
+ flight.getCurrency(), flight.getLink());
items.add(item);
}
- }
-
+ }
+
return items.toArray(new TripItem[items.size()]);
}
-
+
public void searchAsynch(TripLeg tripLeg) {
- System.out.println("Starting flight search");
-
+ System.out.println("Starting flight search");
+
// pretend that this processing takes some time to complete
- while ( percentComplete < 100 ){
+ while (percentComplete < 100) {
try {
Thread.sleep(50);
- } catch(Exception ex){
+ } catch (Exception ex) {
// do nothing
}
percentComplete = percentComplete + 10;
searchCallback.setPercentComplete(componentName, percentComplete);
}
-
+
// return available flights
- searchCallback.searchResults(searchSynch(tripLeg));
+ searchCallback.searchResults(searchSynch(tripLeg));
}
-
- public int getPercentComplete(){
+
+ public int getPercentComplete() {
return 100;
- }
-
+ }
+
public String book(TripItem tripItem) {
return "flight1";
}
diff --git a/sandbox/travelsample/contributions/flight/src/main/java/com/tuscanyscatours/flight/impl/FlightInfo.java b/sandbox/travelsample/contributions/flight/src/main/java/com/tuscanyscatours/flight/impl/FlightInfo.java
index d2b31cd9b7..5f7de69229 100644
--- a/sandbox/travelsample/contributions/flight/src/main/java/com/tuscanyscatours/flight/impl/FlightInfo.java
+++ b/sandbox/travelsample/contributions/flight/src/main/java/com/tuscanyscatours/flight/impl/FlightInfo.java
@@ -19,9 +19,8 @@
package com.tuscanyscatours.flight.impl;
-
public class FlightInfo {
-
+
private String name;
private String description;
private String fromLocation;
@@ -32,12 +31,12 @@ public class FlightInfo {
private double pricePerSeat;
private String currency;
private String link;
-
+
public FlightInfo() {
- }
-
- public FlightInfo(String name,
- String description,
+ }
+
+ public FlightInfo(String name,
+ String description,
String fromLocation,
String toLocation,
String fromDate,
@@ -47,7 +46,6 @@ public class FlightInfo {
String currency,
String link) {
-
this.name = name;
this.description = description;
this.fromLocation = fromLocation;
@@ -58,85 +56,85 @@ public class FlightInfo {
this.pricePerSeat = pricePerSeat;
this.currency = currency;
this.link = link;
- }
-
+ }
+
public String getName() {
return name;
}
-
+
public void setName(String name) {
this.name = name;
- }
-
+ }
+
public String getDescription() {
return description;
}
-
+
public void setDescription(String description) {
- this.description = description;
- }
-
+ this.description = description;
+ }
+
public String getFromLocation() {
return fromLocation;
}
-
+
public void setFromLocation(String fromLocation) {
this.fromLocation = fromLocation;
}
-
+
public String getToLocation() {
return toLocation;
}
-
+
public void setToLocation(String toLocation) {
this.toLocation = toLocation;
}
-
+
public String getFromDate() {
return fromDate;
}
-
+
public void setFromDate(String fromDate) {
this.fromDate = fromDate;
}
-
+
public String getToDate() {
return toDate;
}
-
+
public void setToDate(String toDate) {
this.toDate = toDate;
}
-
+
public String getSeats() {
return seats;
}
-
+
public void setSeats(String seats) {
this.seats = seats;
}
-
+
public double getPricePerSeat() {
return pricePerSeat;
}
-
+
public void setPricePerSeat(double pricePerSeat) {
this.pricePerSeat = pricePerSeat;
}
-
+
public String getCurrency() {
return currency;
}
-
+
public void setCurrency(String currency) {
this.currency = currency;
}
-
+
public String getLink() {
return link;
}
-
+
public void setLink(String link) {
this.link = link;
}
-} \ No newline at end of file
+}
diff --git a/sandbox/travelsample/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/HotelInfo.java b/sandbox/travelsample/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/HotelInfo.java
index a4ba9b3b96..e2912c50fc 100644
--- a/sandbox/travelsample/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/HotelInfo.java
+++ b/sandbox/travelsample/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/HotelInfo.java
@@ -19,9 +19,8 @@
package com.tuscanyscatours.hotel;
-
public class HotelInfo {
-
+
private String name;
private String description;
private String location;
@@ -30,18 +29,18 @@ public class HotelInfo {
private double pricePerBed;
private String currency;
private String link;
-
+
public HotelInfo() {
- }
-
- public HotelInfo(String name,
- String description,
- String location,
- String date,
- String beds,
- double pricePerBed,
- String currency,
- String link) {
+ }
+
+ public HotelInfo(String name,
+ String description,
+ String location,
+ String date,
+ String beds,
+ double pricePerBed,
+ String currency,
+ String link) {
this.name = name;
this.description = description;
@@ -51,69 +50,68 @@ public class HotelInfo {
this.pricePerBed = pricePerBed;
this.currency = currency;
this.link = link;
- }
-
-
+ }
+
public String getName() {
return name;
}
-
+
public void setName(String name) {
this.name = name;
- }
-
+ }
+
public String getDescription() {
return description;
}
-
+
public void setDescription(String description) {
- this.description = description;
- }
-
+ this.description = description;
+ }
+
public String getLocation() {
return location;
}
-
+
public void setLocation(String location) {
this.location = location;
}
-
+
public String getDate() {
return date;
}
-
+
public void setDate(String date) {
this.date = date;
}
-
+
public String getBeds() {
return beds;
- }
-
+ }
+
public void setBeds(String beds) {
this.beds = beds;
}
-
+
public double getPricePerBed() {
return pricePerBed;
}
-
+
public void setPricePerBed(double pricePerBed) {
this.pricePerBed = pricePerBed;
}
-
+
public String getCurrency() {
return currency;
}
-
+
public void setCurrency(String currency) {
this.currency = currency;
}
-
+
public String getLink() {
return link;
}
-
+
public void setLink(String link) {
this.link = link;
}
diff --git a/sandbox/travelsample/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/impl/HotelImpl.java b/sandbox/travelsample/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/impl/HotelImpl.java
index eefa88a9cd..fe8953ea0e 100644
--- a/sandbox/travelsample/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/impl/HotelImpl.java
+++ b/sandbox/travelsample/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/impl/HotelImpl.java
@@ -38,99 +38,68 @@ import com.tuscanyscatours.hotel.HotelManagement;
* An implementation of the Hotel service
*/
@Scope("STATELESS")
-@Service(interfaces={Search.class, Book.class, HotelManagement.class})
+@Service(interfaces = {Search.class, Book.class, HotelManagement.class})
public class HotelImpl implements Search, Book, HotelManagement {
-
+
private List<HotelInfo> hotels = new ArrayList<HotelInfo>();
-
+
@Callback
- protected SearchCallback searchCallback;
+ protected SearchCallback searchCallback;
@Init
public void init() {
- hotels.add(new HotelInfo("Deep Bay Hotel",
- "Wonderful sea views and a relaxed atmosphere",
- "FLR",
- "06/12/09",
- "200",
- 100,
- "EUR",
- "http://localhost:8085/tbd" ));
- hotels.add(new HotelInfo("Long Bay Hotel",
- "Friendly staff and an ocean breeze",
- "FLR",
- "06/12/09",
- "200",
- 100,
- "EUR",
- "http://localhost:8085/tbd" ));
- hotels.add(new HotelInfo("City Hotel",
- "Smart rooms and early breakfasts",
- "FLR",
- "06/12/09",
- "200",
- 100,
- "EUR",
- "http://localhost:8085/tbd" ));
- hotels.add(new HotelInfo("County Hotel",
- "The smell of the open country",
- "FLR",
- "06/12/09",
- "200",
- 100,
- "EUR",
- "http://localhost:8085/tbd" ));
+ hotels.add(new HotelInfo("Deep Bay Hotel", "Wonderful sea views and a relaxed atmosphere", "FLR", "06/12/09",
+ "200", 100, "EUR", "http://localhost:8085/tbd"));
+ hotels.add(new HotelInfo("Long Bay Hotel", "Friendly staff and an ocean breeze", "FLR", "06/12/09", "200", 100,
+ "EUR", "http://localhost:8085/tbd"));
+ hotels.add(new HotelInfo("City Hotel", "Smart rooms and early breakfasts", "FLR", "06/12/09", "200", 100,
+ "EUR", "http://localhost:8085/tbd"));
+ hotels.add(new HotelInfo("County Hotel", "The smell of the open country", "FLR", "06/12/09", "200", 100, "EUR",
+ "http://localhost:8085/tbd"));
}
-
+
public TripItem[] searchSynch(TripLeg tripLeg) {
List<TripItem> items = new ArrayList<TripItem>();
-
+
// find available hotels
- for(HotelInfo hotel : hotels){
- if (hotel.getLocation().equals(tripLeg.getToLocation())){
- TripItem item = new TripItem("",
- "",
- TripItem.HOTEL,
- hotel.getName(),
- hotel.getDescription(),
- hotel.getLocation(),
- tripLeg.getFromDate(),
- tripLeg.getToDate(),
- hotel.getPricePerBed(),
- hotel.getCurrency(),
- hotel.getLink());
+ for (HotelInfo hotel : hotels) {
+ if (hotel.getLocation().equals(tripLeg.getToLocation())) {
+ TripItem item =
+ new TripItem("", "", TripItem.HOTEL, hotel.getName(), hotel.getDescription(), hotel.getLocation(),
+ tripLeg.getFromDate(), tripLeg.getToDate(), hotel.getPricePerBed(), hotel
+ .getCurrency(), hotel.getLink());
items.add(item);
}
}
-
+
return items.toArray(new TripItem[items.size()]);
}
-
+
public void searchAsynch(TripLeg tripLeg) {
- System.out.println("Starting hotel search");
-
- // pretend that this processing takes some time to complete
+ System.out.println("Starting hotel search");
+
+ // pretend that this processing takes some time to complete
try {
Thread.sleep(3000);
- } catch(Exception ex){
+ } catch (Exception ex) {
// do nothing
}
-
+
// return available hotels
TripItem[] items = searchSynch(tripLeg);
- searchCallback.searchResults(items);
+ searchCallback.searchResults(items);
}
-
- public int getPercentComplete(){
+
+ public int getPercentComplete() {
return 100;
}
-
+
public String book(TripItem tripItem) {
return "hotel1";
}
-
- public void addHotelInfo(HotelInfo hotelInfo){
- hotels.add(hotelInfo);
- System.out.println("Added hotel info - " + hotelInfo.getName());
+
+ public void addHotelInfo(HotelInfo hotelInfo) {
+ hotels.add(hotelInfo);
+ System.out.println("Added hotel info - " + hotelInfo.getName());
}
}
diff --git a/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionConversationClientImpl.java b/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionConversationClientImpl.java
index 0bb662e737..290e6e6aee 100644
--- a/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionConversationClientImpl.java
+++ b/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionConversationClientImpl.java
@@ -19,60 +19,55 @@
package scatours.client.impl;
-import java.util.concurrent.CountDownLatch;
-
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Scope;
import org.osoa.sca.annotations.Service;
-import com.tuscanyscatours.common.Search;
-import com.tuscanyscatours.common.SearchCallback;
import com.tuscanyscatours.common.TripItem;
-import com.tuscanyscatours.common.TripLeg;
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");
+ 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);
- // 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){
+ 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){
+ for (TripItem item : tripItems) {
System.out.println("Item - " + item.getDescription());
}
- }
-
- private TripItem getTestTripItem(){
+ }
+
+ 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;
- }
+ return tripItem;
+ }
}
diff --git a/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionLocalClientImpl.java b/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionLocalClientImpl.java
index b5594dfa7e..ca3cb2874a 100644
--- a/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionLocalClientImpl.java
+++ b/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionLocalClientImpl.java
@@ -27,26 +27,27 @@ 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);;
+ 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;
+
+ 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/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionOneWayCallbackClientImpl.java b/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionOneWayCallbackClientImpl.java
index d764917276..9689ce8e0c 100644
--- a/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionOneWayCallbackClientImpl.java
+++ b/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionOneWayCallbackClientImpl.java
@@ -32,47 +32,47 @@ import com.tuscanyscatours.common.TripLeg;
@Scope("COMPOSITE")
@Service(Runnable.class)
-public class InteractionOneWayCallbackClientImpl implements Runnable, SearchCallback{
-
+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
+ 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){
+ } catch (InterruptedException ex) {
}
}
-
- public void searchResults(TripItem[] items){
- for (TripItem tripItem : items){
+
+ 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){
+ }
+
+ 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;
- }
+ }
+
+ 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/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRemoteClientImpl.java b/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRemoteClientImpl.java
index 91350fdc88..1fd9d9cbe8 100644
--- a/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRemoteClientImpl.java
+++ b/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRemoteClientImpl.java
@@ -29,36 +29,36 @@ 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());
- }
+ 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){
+
+ 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){
+ // 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;
- }
+ }
+
+ 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/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRequestResponseClientImpl.java b/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRequestResponseClientImpl.java
index 47f9be540b..d1438434ae 100644
--- a/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRequestResponseClientImpl.java
+++ b/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRequestResponseClientImpl.java
@@ -22,21 +22,18 @@ package scatours.client.impl;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
-import com.tuscanyscatours.calendar.Calendar;
-
-import com.tuscanyscatours.common.TripLeg;
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);
+ 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/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionStatefulCallbackClientImpl.java b/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionStatefulCallbackClientImpl.java
index 5d8285835e..87cea904ac 100644
--- a/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionStatefulCallbackClientImpl.java
+++ b/sandbox/travelsample/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionStatefulCallbackClientImpl.java
@@ -24,7 +24,6 @@ import java.util.concurrent.CountDownLatch;
import org.osoa.sca.ComponentContext;
import org.osoa.sca.ServiceReference;
import org.osoa.sca.annotations.Context;
-import org.osoa.sca.annotations.ConversationID;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Scope;
import org.osoa.sca.annotations.Service;
@@ -37,62 +36,63 @@ import com.tuscanyscatours.common.TripLeg;
@Scope("CONVERSATION")
@Service(Runnable.class)
public class InteractionStatefulCallbackClientImpl implements Runnable, SearchCallback {
-
+
@Reference
protected Search flightSearchStatefulCallback;
-
+
@Context
protected ComponentContext componentContext;
-
+
CountDownLatch resultsReceivedCountdown;
-
+
public void run() {
- System.out.println("\nCalling flight component using stateful callback interation pattern");
- resultsReceivedCountdown = new CountDownLatch(1);
- TripLeg tripLeg = getTestTripLeg();
-
- ServiceReference<Search> dynamicFlightSearchStatefulCallback =
+ System.out.println("\nCalling flight component using stateful callback interation pattern");
+ resultsReceivedCountdown = new CountDownLatch(1);
+ TripLeg tripLeg = getTestTripLeg();
+
+ ServiceReference<Search> dynamicFlightSearchStatefulCallback =
componentContext.getServiceReference(Search.class, "flightSearchStatefulCallback");
- dynamicFlightSearchStatefulCallback.setConversationID("SomeUniqeID");
+ dynamicFlightSearchStatefulCallback.setConversationID("SomeUniqeID");
Search flightSearch = dynamicFlightSearchStatefulCallback.getService();
-
+
flightSearch.searchAsynch(tripLeg);
-
+
// wait for a while and see how the flight search is getting one
try {
Thread.sleep(1200);
- } catch(Exception ex){
+ } catch (Exception ex) {
// do nothing
}
System.out.println("Flight search is " + flightSearch.getPercentComplete() + "% complete");
-
- // wait for responses to come back
+
+ // wait for responses to come back
try {
resultsReceivedCountdown.await();
- } catch (InterruptedException ex){
+ } catch (InterruptedException ex) {
}
}
-
- public void searchResults(TripItem[] items){
- System.out.println("Received results in conversation - " + componentContext.getRequestContext().getServiceReference().getConversation().getConversationID());
- for (TripItem tripItem : items){
+
+ public void searchResults(TripItem[] items) {
+ System.out.println("Received results in conversation - " + componentContext.getRequestContext()
+ .getServiceReference().getConversation().getConversationID());
+ for (TripItem tripItem : items) {
System.out.println("Found flight - " + tripItem.getName());
}
resultsReceivedCountdown.countDown();
- }
-
- public void setPercentComplete(String searchComponent, int percentComplete){
+ }
+
+ public void setPercentComplete(String searchComponent, int percentComplete) {
System.out.println(searchComponent + " search is " + percentComplete + "% complete");
- }
-
- private TripLeg getTestTripLeg(){
- TripLeg tripLeg = new TripLeg();
- tripLeg.setFromLocation("LGW");
- tripLeg.setToLocation("FLR");
- tripLeg.setFromDate("06/12/09");
- tripLeg.setToDate("13/12/09");
- tripLeg.setNoOfPeople("1");
- tripLeg.setId("TRIP27");
- return tripLeg;
- }
+ }
+
+ private TripLeg getTestTripLeg() {
+ TripLeg tripLeg = new TripLeg();
+ tripLeg.setFromLocation("LGW");
+ tripLeg.setToLocation("FLR");
+ tripLeg.setFromDate("06/12/09");
+ tripLeg.setToDate("13/12/09");
+ tripLeg.setNoOfPeople("1");
+ tripLeg.setId("TRIP27");
+ return tripLeg;
+ }
}
diff --git a/sandbox/travelsample/contributions/introducing-client/src/main/java/scatours/client/impl/TestClientImpl.java b/sandbox/travelsample/contributions/introducing-client/src/main/java/scatours/client/impl/TestClientImpl.java
index 7a8258795b..f81a2c7304 100644
--- a/sandbox/travelsample/contributions/introducing-client/src/main/java/scatours/client/impl/TestClientImpl.java
+++ b/sandbox/travelsample/contributions/introducing-client/src/main/java/scatours/client/impl/TestClientImpl.java
@@ -21,12 +21,12 @@ package scatours.client.impl;
import java.math.BigDecimal;
-import com.tuscanyscatours.Bookings;
-import com.tuscanyscatours.Checkout;
-
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
+import com.tuscanyscatours.Bookings;
+import com.tuscanyscatours.Checkout;
+
@Service(Runnable.class)
public class TestClientImpl {
@Reference
diff --git a/sandbox/travelsample/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java b/sandbox/travelsample/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java
index 7d2fe8f951..056becf435 100644
--- a/sandbox/travelsample/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java
+++ b/sandbox/travelsample/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java
@@ -21,21 +21,26 @@ 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>();
-
+ private static List<String> bookedTrips = new ArrayList<String>();
+
public void makePayment(BigDecimal amount, String cardInfo) {
- System.out.print("Charged $" + amount + " to card " + cardInfo + " for " +
- (bookedTrips.size() > 1 ? "trips" : "trip"));
- for (String trip : bookedTrips){
- System.out.print(" " + trip);
- }
- System.out.println();
- bookedTrips.clear();
+ System.out.print("Charged $" + 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/sandbox/travelsample/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java b/sandbox/travelsample/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java
index cd1573380c..f2884f87c5 100644
--- a/sandbox/travelsample/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java
+++ b/sandbox/travelsample/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java
@@ -18,10 +18,11 @@
*/
package com.tuscanyscatours.impl;
+import org.osoa.sca.annotations.Reference;
+
import com.goodvaluetrips.Trips;
import com.tuscanyscatours.Bookings;
import com.tuscanyscatours.Updates;
-import org.osoa.sca.annotations.Reference;
public class TripBookingImpl implements Bookings {
@Reference
@@ -29,7 +30,7 @@ public class TripBookingImpl implements Bookings {
@Reference
protected Updates cart;
-
+
public String newBooking(String trip, int people) {
String resCode = mytrips.checkAvailability(trip, people);
cart.addTrip(resCode);
diff --git a/sandbox/travelsample/contributions/notification/src/main/java/com/tuscanyscatours/notification/Notification.java b/sandbox/travelsample/contributions/notification/src/main/java/com/tuscanyscatours/notification/Notification.java
index 2767844c2c..7ae26b93e4 100644
--- a/sandbox/travelsample/contributions/notification/src/main/java/com/tuscanyscatours/notification/Notification.java
+++ b/sandbox/travelsample/contributions/notification/src/main/java/com/tuscanyscatours/notification/Notification.java
@@ -20,7 +20,7 @@
package com.tuscanyscatours.notification;
public interface Notification {
-
- boolean notify(String accountID, String subject, String message);
+
+ boolean notify(String accountID, String subject, String message);
}
diff --git a/sandbox/travelsample/contributions/notification/src/main/java/com/tuscanyscatours/notification/impl/NotificationImpl.java b/sandbox/travelsample/contributions/notification/src/main/java/com/tuscanyscatours/notification/impl/NotificationImpl.java
index f374e22afe..58d590242d 100644
--- a/sandbox/travelsample/contributions/notification/src/main/java/com/tuscanyscatours/notification/impl/NotificationImpl.java
+++ b/sandbox/travelsample/contributions/notification/src/main/java/com/tuscanyscatours/notification/impl/NotificationImpl.java
@@ -28,32 +28,31 @@ import com.tuscanyscatours.smsgateway.SMSGateway;
@Service(Notification.class)
public class NotificationImpl implements Notification {
- /**
- * Use "Fake" phone number that has been reserved by Ofcom.
- * See: http://www.ofcom.org.uk/telecoms/ioi/numbers/num_drama?a=87101
- */
- private static final String SCA_TOURS_SMS ="+44(0)2079460723";
-
- @Reference
- protected SMSGateway smsGateway;
-
- public boolean notify(String accountID,
- String subject, String message) {
-
- boolean result = true;
-
- String sms = getSMSAddress(accountID);
- if (sms != null) {
- System.out.println("Sending SMS to " + sms + " for accountID " + accountID);
- result &= smsGateway.sendSMS(SCA_TOURS_SMS, sms, subject + ". " + message);
- }
+ /**
+ * Use "Fake" phone number that has been reserved by Ofcom.
+ * See: http://www.ofcom.org.uk/telecoms/ioi/numbers/num_drama?a=87101
+ */
+ private static final String SCA_TOURS_SMS = "+44(0)2079460723";
+
+ @Reference
+ protected SMSGateway smsGateway;
+
+ public boolean notify(String accountID, String subject, String message) {
+
+ boolean result = true;
- return result;
- }
+ String sms = getSMSAddress(accountID);
+ if (sms != null) {
+ System.out.println("Sending SMS to " + sms + " for accountID " + accountID);
+ result &= smsGateway.sendSMS(SCA_TOURS_SMS, sms, subject + ". " + message);
+ }
- private String getSMSAddress(String accountID) {
- // Use "Fake" phone number that has been reserved by Ofcom.
- // See: http://www.ofcom.org.uk/telecoms/ioi/numbers/num_drama?a=87101
- return "+44(0)7700900812";
- }
+ return result;
+ }
+
+ private String getSMSAddress(String accountID) {
+ // Use "Fake" phone number that has been reserved by Ofcom.
+ // See: http://www.ofcom.org.uk/telecoms/ioi/numbers/num_drama?a=87101
+ return "+44(0)7700900812";
+ }
}
diff --git a/sandbox/travelsample/contributions/payment-bpel/src/test/java/scatours/payment/PaymentTestCase.java b/sandbox/travelsample/contributions/payment-bpel/src/test/java/scatours/payment/PaymentTestCase.java
index 76ef390d62..84d628ec5d 100644
--- a/sandbox/travelsample/contributions/payment-bpel/src/test/java/scatours/payment/PaymentTestCase.java
+++ b/sandbox/travelsample/contributions/payment-bpel/src/test/java/scatours/payment/PaymentTestCase.java
@@ -19,7 +19,6 @@
package scatours.payment;
-import com.tuscanyscatours.payment.Payment;
import org.apache.tuscany.sca.node.SCAClient;
import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode;
@@ -28,37 +27,46 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import com.tuscanyscatours.payment.Payment;
+
/**
*
*/
public class PaymentTestCase {
private static SCANode paymentNode;
private static SCANode creditCardNode;
- private static SCANode emailGatewayNode;
+ private static SCANode emailGatewayNode;
@BeforeClass
- public static void setUpBeforeClass() throws Exception {
- creditCardNode = SCANodeFactory.newInstance().createSCANode("creditcard.composite",
- new SCAContribution("creditcard", "../creditcard-payment-jaxb/target/classes"));
-
+ public static void setUpBeforeClass() throws Exception {
+ creditCardNode =
+ SCANodeFactory.newInstance()
+ .createSCANode("creditcard.composite",
+ new SCAContribution("creditcard", "../creditcard-payment-jaxb/target/classes"));
+
creditCardNode.start();
-
- emailGatewayNode = SCANodeFactory.newInstance().createSCANode("emailgateway.composite",
- new SCAContribution("emailgateway", "../emailgateway/target/classes"),
- new SCAContribution("emailgateway-test", "../emailgateway/target/test-classes"));
-
- emailGatewayNode.start();
- paymentNode = SCANodeFactory.newInstance().createSCANode(null,
- new SCAContribution("payment-bpel", "./target/classes"),
- new SCAContribution("payment-bpel-test", "./target/test-classes"));
+ emailGatewayNode =
+ SCANodeFactory.newInstance().createSCANode("emailgateway.composite",
+ new SCAContribution("emailgateway",
+ "../emailgateway/target/classes"),
+ new SCAContribution("emailgateway-test",
+ "../emailgateway/target/test-classes"));
+
+ emailGatewayNode.start();
+
+ paymentNode =
+ SCANodeFactory.newInstance()
+ .createSCANode(null,
+ new SCAContribution("payment-bpel", "./target/classes"),
+ new SCAContribution("payment-bpel-test", "./target/test-classes"));
paymentNode.start();
}
-
+
@Test
public void testPayment() {
- SCAClient client = (SCAClient) paymentNode;
+ SCAClient client = (SCAClient)paymentNode;
Payment payment = client.getService(Payment.class, "PaymentClient");
System.out.println("Result = " + payment.makePaymentMember("Fred", 100.00f));
}
diff --git a/sandbox/travelsample/contributions/payment-groovy/src/test/java/scatours/payment/PaymentTestCase.java b/sandbox/travelsample/contributions/payment-groovy/src/test/java/scatours/payment/PaymentTestCase.java
index 39fffb0b9c..907bcc93f8 100644
--- a/sandbox/travelsample/contributions/payment-groovy/src/test/java/scatours/payment/PaymentTestCase.java
+++ b/sandbox/travelsample/contributions/payment-groovy/src/test/java/scatours/payment/PaymentTestCase.java
@@ -19,7 +19,6 @@
package scatours.payment;
-import com.tuscanyscatours.payment.Payment;
import org.apache.tuscany.sca.node.SCAClient;
import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode;
@@ -28,6 +27,8 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import com.tuscanyscatours.payment.Payment;
+
/**
*
*/
@@ -35,31 +36,38 @@ public class PaymentTestCase {
private static SCANode paymentNode;
private static SCANode creditCardNode;
- private static SCANode emailGatewayNode;
+ private static SCANode emailGatewayNode;
@BeforeClass
- public static void setUpBeforeClass() throws Exception {
- creditCardNode = SCANodeFactory.newInstance().createSCANode("creditcard.composite",
- new SCAContribution("creditcard", "../creditcard-payment-jaxb/target/classes"));
-
+ public static void setUpBeforeClass() throws Exception {
+ creditCardNode =
+ SCANodeFactory.newInstance()
+ .createSCANode("creditcard.composite",
+ new SCAContribution("creditcard", "../creditcard-payment-jaxb/target/classes"));
+
creditCardNode.start();
-
- emailGatewayNode = SCANodeFactory.newInstance().createSCANode("emailgateway.composite",
- new SCAContribution("emailgateway", "../emailgateway/target/classes"),
- new SCAContribution("emailgateway-test", "../emailgateway/target/test-classes"));
-
- emailGatewayNode.start();
- paymentNode = SCANodeFactory.newInstance().createSCANode(null,
- new SCAContribution("payment-groovy", "./target/classes"),
- new SCAContribution("payment-groovy-test", "./target/test-classes"));
+ emailGatewayNode =
+ SCANodeFactory.newInstance().createSCANode("emailgateway.composite",
+ new SCAContribution("emailgateway",
+ "../emailgateway/target/classes"),
+ new SCAContribution("emailgateway-test",
+ "../emailgateway/target/test-classes"));
+
+ emailGatewayNode.start();
+
+ paymentNode =
+ SCANodeFactory.newInstance().createSCANode(null,
+ new SCAContribution("payment-groovy", "./target/classes"),
+ new SCAContribution("payment-groovy-test",
+ "./target/test-classes"));
paymentNode.start();
}
-
+
@Test
public void testPayment() {
- SCAClient client = (SCAClient) paymentNode;
+ SCAClient client = (SCAClient)paymentNode;
Payment payment = client.getService(Payment.class, "PaymentClient");
System.out.println("Result = " + payment.makePaymentMember("Fred", 100.00f));
}
diff --git a/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java b/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java
index fdced0d659..b08f76e0fa 100644
--- a/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java
+++ b/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java
@@ -19,7 +19,6 @@
package com.tuscanyscatours.customer;
-
public class CustomerNotFoundException extends Exception {
private static final long serialVersionUID = -129752837478357452L;
diff --git a/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java b/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java
index 6364701b9c..26926c7764 100644
--- a/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java
+++ b/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java
@@ -64,12 +64,12 @@ public class CustomerRegistryImpl implements CustomerRegistry {
cc.setExpYear(2012);
createCustomer("John Smith", "john@xyz.com", cc);
}
-
+
@Destroy
public void destroy() {
// Save the customers
}
-
+
public Customer createCustomer(String name, String email, CreditCardDetailsType creditCard) {
Customer customer = new Customer();
customer.setId("c-" + idGenerator++);
@@ -90,11 +90,11 @@ public class CustomerRegistryImpl implements CustomerRegistry {
public Customer getCustomer(String id) throws CustomerNotFoundException {
Customer customer = customers.get(id);
-
- if (customer == null){
+
+ if (customer == null) {
throw new CustomerNotFoundException("Customer " + id + " not found");
}
-
+
return customer;
}
diff --git a/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java b/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java
index ac7255ef59..d9798e436a 100644
--- a/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java
+++ b/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java
@@ -20,6 +20,7 @@
package com.tuscanyscatours.emailgateway.impl;
import org.osoa.sca.annotations.Service;
+
import com.tuscanyscatours.emailgateway.EmailGateway;
@Service(EmailGateway.class)
diff --git a/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java b/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java
index 16e91d7284..b3eb95b44b 100644
--- a/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java
+++ b/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java
@@ -19,10 +19,6 @@
package com.tuscanyscatours.payment.impl;
-import javax.annotation.security.RolesAllowed;
-import javax.annotation.security.RunAs;
-
-import org.osoa.sca.annotations.Authentication;
import org.osoa.sca.annotations.Property;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Requires;
@@ -61,11 +57,10 @@ public class PaymentImpl implements Payment {
public String makePaymentMember(String customerId, float amount) {
try {
Customer customer = customerRegistry.getCustomer(customerId);
- String status = creditCardPayment.authorize(customer.getCreditCard(),
- amount + transactionFee);
- emailGateway.sendEmail("order@tuscanyscatours.com",
- customer.getEmail(),
- "Status for your payment",
+ String status = creditCardPayment.authorize(customer.getCreditCard(), amount + transactionFee);
+ emailGateway.sendEmail("order@tuscanyscatours.com",
+ customer.getEmail(),
+ "Status for your payment",
customer + " >>> Status = " + status);
return status;
} catch (CustomerNotFoundException ex) {
@@ -74,6 +69,6 @@ public class PaymentImpl implements Payment {
return e.getFaultInfo().getErrorCode();
} catch (Throwable t) {
return "Payment failed due to system error " + t.getMessage();
- }
+ }
}
}
diff --git a/sandbox/travelsample/contributions/payment-java-policy/src/test/java/scatours/payment/PaymentTestCase.java b/sandbox/travelsample/contributions/payment-java-policy/src/test/java/scatours/payment/PaymentTestCase.java
index e408d89df9..5fd8900fce 100644
--- a/sandbox/travelsample/contributions/payment-java-policy/src/test/java/scatours/payment/PaymentTestCase.java
+++ b/sandbox/travelsample/contributions/payment-java-policy/src/test/java/scatours/payment/PaymentTestCase.java
@@ -19,7 +19,6 @@
package scatours.payment;
-import com.tuscanyscatours.payment.Payment;
import org.apache.tuscany.sca.node.SCAClient;
import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode;
@@ -29,26 +28,31 @@ import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
+import com.tuscanyscatours.payment.Payment;
+
public class PaymentTestCase {
private static SCANode node;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
- node = SCANodeFactory.newInstance().createSCANode(null,
- new SCAContribution("payment", "./target/classes"),
- new SCAContribution("creditcard", "../../contributions/creditcard-payment-jaxb/target/classes"));
+ node =
+ SCANodeFactory.newInstance()
+ .createSCANode(null,
+ new SCAContribution("payment", "./target/classes"),
+ new SCAContribution("creditcard",
+ "../../contributions/creditcard-payment-jaxb/target/classes"));
node.start();
}
-
+
@Test
public void testPayment() {
- SCAClient client = (SCAClient) node;
+ SCAClient client = (SCAClient)node;
Payment payment = client.getService(Payment.class, "Payment");
-
+
System.out.println("\n\nSuccessful Payment - Status = \n\n" + payment.makePaymentMember("c-0", 100.00f));
System.out.println("\n\nFailed Payment - Status = \n\n" + payment.makePaymentMember("c-1", 100.00f));
}
-
+
@Test
@Ignore
public void testWaitForInput() {
@@ -58,7 +62,7 @@ public class PaymentTestCase {
} catch (Exception ex) {
}
System.out.println("Shutting down");
- }
+ }
@AfterClass
public static void tearDownAfterClass() throws Exception {
diff --git a/sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java b/sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java
index 58772c747c..7f028c301e 100644
--- a/sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java
+++ b/sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java
@@ -19,7 +19,6 @@
package com.tuscanyscatours.customer;
-
public class CustomerNotFoundException extends Exception {
private static final long serialVersionUID = -129752837478357452L;
diff --git a/sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java b/sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java
index ac7b71c17f..bc76f411f3 100644
--- a/sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java
+++ b/sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java
@@ -64,12 +64,12 @@ public class CustomerRegistryImpl implements CustomerRegistry {
cc.setExpYear(2012);
createCustomer("John Smith", "john@xyz.com", cc);
}
-
+
@Destroy
public void destroy() {
// Save the customers
}
-
+
public Customer createCustomer(String name, String email, CreditCardDetailsType creditCard) {
Customer customer = new Customer();
customer.setId("c-" + idGenerator++);
@@ -90,11 +90,11 @@ public class CustomerRegistryImpl implements CustomerRegistry {
public Customer getCustomer(String id) throws CustomerNotFoundException {
Customer customer = customers.get(id);
-
- if (customer == null){
+
+ if (customer == null) {
throw new CustomerNotFoundException("Customer " + id + " not found");
}
-
+
return customer;
}
diff --git a/sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java b/sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java
index b942eebddf..a6a162d5c3 100644
--- a/sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java
+++ b/sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java
@@ -20,6 +20,7 @@
package com.tuscanyscatours.emailgateway.impl;
import org.osoa.sca.annotations.Service;
+
import com.tuscanyscatours.emailgateway.EmailGateway;
@Service(EmailGateway.class)
diff --git a/sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java b/sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java
index e5010c88e9..988605f7cd 100644
--- a/sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java
+++ b/sandbox/travelsample/contributions/payment-java/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java
@@ -19,10 +19,6 @@
package com.tuscanyscatours.payment.impl;
-import javax.annotation.security.RolesAllowed;
-import javax.annotation.security.RunAs;
-
-import org.osoa.sca.annotations.Authentication;
import org.osoa.sca.annotations.Property;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
@@ -33,7 +29,6 @@ import com.tuscanyscatours.customer.CustomerRegistry;
import com.tuscanyscatours.emailgateway.EmailGateway;
import com.tuscanyscatours.payment.Payment;
import com.tuscanyscatours.payment.creditcard.AuthorizeFault_Exception;
-import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType;
import com.tuscanyscatours.payment.creditcard.CreditCardPayment;
/**
@@ -57,11 +52,10 @@ public class PaymentImpl implements Payment {
public String makePaymentMember(String customerId, float amount) {
try {
Customer customer = customerRegistry.getCustomer(customerId);
- String status = creditCardPayment.authorize(customer.getCreditCard(),
- amount + transactionFee);
- emailGateway.sendEmail("order@tuscanyscatours.com",
- customer.getEmail(),
- "Status for your payment",
+ String status = creditCardPayment.authorize(customer.getCreditCard(), amount + transactionFee);
+ emailGateway.sendEmail("order@tuscanyscatours.com",
+ customer.getEmail(),
+ "Status for your payment",
customer + " >>> Status = " + status);
return status;
} catch (CustomerNotFoundException ex) {
@@ -70,6 +64,6 @@ public class PaymentImpl implements Payment {
return e.getFaultInfo().getErrorCode();
} catch (Throwable t) {
return "Payment failed due to system error " + t.getMessage();
- }
+ }
}
}
diff --git a/sandbox/travelsample/contributions/payment-java/src/test/java/scatours/payment/PaymentTestCase.java b/sandbox/travelsample/contributions/payment-java/src/test/java/scatours/payment/PaymentTestCase.java
index 631642ea0a..ead8b87db0 100644
--- a/sandbox/travelsample/contributions/payment-java/src/test/java/scatours/payment/PaymentTestCase.java
+++ b/sandbox/travelsample/contributions/payment-java/src/test/java/scatours/payment/PaymentTestCase.java
@@ -19,7 +19,6 @@
package scatours.payment;
-import com.tuscanyscatours.payment.Payment;
import org.apache.tuscany.sca.node.SCAClient;
import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode;
@@ -29,26 +28,31 @@ import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
+import com.tuscanyscatours.payment.Payment;
+
public class PaymentTestCase {
private static SCANode node;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
- node = SCANodeFactory.newInstance().createSCANode(null,
- new SCAContribution("payment", "./target/classes"),
- new SCAContribution("creditcard", "../../contributions/creditcard-payment-jaxb/target/classes"));
+ node =
+ SCANodeFactory.newInstance()
+ .createSCANode(null,
+ new SCAContribution("payment", "./target/classes"),
+ new SCAContribution("creditcard",
+ "../../contributions/creditcard-payment-jaxb/target/classes"));
node.start();
}
-
+
@Test
public void testPayment() {
- SCAClient client = (SCAClient) node;
+ SCAClient client = (SCAClient)node;
Payment payment = client.getService(Payment.class, "Payment");
-
+
System.out.println("\n\nSuccessful Payment - Status = \n\n" + payment.makePaymentMember("c-0", 100.00f));
System.out.println("\n\nFailed Payment - Status = \n\n" + payment.makePaymentMember("c-1", 100.00f));
}
-
+
@Test
@Ignore
public void testWaitForInput() {
@@ -58,7 +62,7 @@ public class PaymentTestCase {
} catch (Exception ex) {
}
System.out.println("Shutting down");
- }
+ }
@AfterClass
public static void tearDownAfterClass() throws Exception {
diff --git a/sandbox/travelsample/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java b/sandbox/travelsample/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java
index fdced0d659..b08f76e0fa 100644
--- a/sandbox/travelsample/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java
+++ b/sandbox/travelsample/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java
@@ -19,7 +19,6 @@
package com.tuscanyscatours.customer;
-
public class CustomerNotFoundException extends Exception {
private static final long serialVersionUID = -129752837478357452L;
diff --git a/sandbox/travelsample/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java b/sandbox/travelsample/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java
index 809afb5b84..4381029543 100644
--- a/sandbox/travelsample/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java
+++ b/sandbox/travelsample/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java
@@ -26,7 +26,6 @@ import java.util.Map;
import org.osoa.sca.annotations.Destroy;
import org.osoa.sca.annotations.EagerInit;
import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Requires;
import org.osoa.sca.annotations.Scope;
import org.osoa.sca.annotations.Service;
@@ -63,12 +62,12 @@ public class CustomerRegistryImpl implements CustomerRegistry {
cc.setExpYear(2012);
createCustomer("John Smith", "john@xyz.com", cc);
}
-
+
@Destroy
public void destroy() {
// Save the customers
}
-
+
public Customer createCustomer(String name, String email, CreditCardDetailsType creditCard) {
Customer customer = new Customer();
customer.setId("c-" + idGenerator++);
@@ -89,11 +88,11 @@ public class CustomerRegistryImpl implements CustomerRegistry {
public Customer getCustomer(String id) throws CustomerNotFoundException {
Customer customer = customers.get(id);
-
- if (customer == null){
+
+ if (customer == null) {
throw new CustomerNotFoundException("Customer " + id + " not found");
}
-
+
return customer;
}
diff --git a/sandbox/travelsample/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java b/sandbox/travelsample/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java
index 8dfe4b2b40..a35f761dc7 100644
--- a/sandbox/travelsample/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java
+++ b/sandbox/travelsample/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java
@@ -33,45 +33,45 @@ public class PaymentImpl implements Payment {
private CustomerRegistry customerRegistry;
private EmailGateway emailGateway;
private float transactionFee;
-
+
public void setCreditCardPayment(CreditCardPayment creditCardPayment) {
this.creditCardPayment = creditCardPayment;
}
-
+
public void setCustomerRegistry(CustomerRegistry customerRegistry) {
this.customerRegistry = customerRegistry;
- }
-
+ }
+
public void setEmailGateway(EmailGateway emailGateway) {
this.emailGateway = emailGateway;
}
-
+
public void setTransactionFee(Float transactionFee) {
this.transactionFee = transactionFee;
}
-
+
public String makePaymentMember(String customerId, float amount) {
try {
Customer customer = customerRegistry.getCustomer(customerId);
-
+
amount += transactionFee;
-
+
String status = creditCardPayment.authorize(customer.getCreditCard(), amount);
-
- com.tuscanyscatours.emailgateway.ObjectFactory emailFactory
- = new com.tuscanyscatours.emailgateway.ObjectFactory();
+
+ com.tuscanyscatours.emailgateway.ObjectFactory emailFactory =
+ new com.tuscanyscatours.emailgateway.ObjectFactory();
EmailType email = emailFactory.createEmailType();
email.setTitle("Payment Received");
email.setTo(customerId);
-
+
emailGateway.sendEmail(email);
-
+
return status;
} catch (CustomerNotFoundException ex) {
return "Payment failed due to " + ex.getMessage();
} catch (Throwable t) {
return "Payment failed due to system error " + t.getMessage();
- }
+ }
}
}
diff --git a/sandbox/travelsample/contributions/payment-spring-policy/src/test/java/scatours/payment/PaymentTestCase.java b/sandbox/travelsample/contributions/payment-spring-policy/src/test/java/scatours/payment/PaymentTestCase.java
index 7d02dccc57..0bff419ccd 100644
--- a/sandbox/travelsample/contributions/payment-spring-policy/src/test/java/scatours/payment/PaymentTestCase.java
+++ b/sandbox/travelsample/contributions/payment-spring-policy/src/test/java/scatours/payment/PaymentTestCase.java
@@ -19,7 +19,6 @@
package scatours.payment;
-import com.tuscanyscatours.payment.Payment;
import org.apache.tuscany.sca.node.SCAClient;
import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode;
@@ -28,6 +27,8 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import com.tuscanyscatours.payment.Payment;
+
/**
*
*/
@@ -36,22 +37,26 @@ public class PaymentTestCase {
private static SCANode creditCardNode;
@BeforeClass
- public static void setUpBeforeClass() throws Exception {
- creditCardNode = SCANodeFactory.newInstance().createSCANode("creditcard.composite",
- new SCAContribution("creditcard", "../creditcard-payment-jaxb-policy/target/classes"));
-
+ public static void setUpBeforeClass() throws Exception {
+ creditCardNode =
+ SCANodeFactory.newInstance()
+ .createSCANode("creditcard.composite",
+ new SCAContribution("creditcard", "../creditcard-payment-jaxb-policy/target/classes"));
+
creditCardNode.start();
-
- paymentNode = SCANodeFactory.newInstance().createSCANode(null,
- new SCAContribution("payment-spring-policy", "./target/classes"),
- new SCAContribution("payment-spring-policy-test", "./target/test-classes"));
+
+ paymentNode =
+ SCANodeFactory.newInstance()
+ .createSCANode(null,
+ new SCAContribution("payment-spring-policy", "./target/classes"),
+ new SCAContribution("payment-spring-policy-test", "./target/test-classes"));
paymentNode.start();
}
-
+
@Test
public void testPayment() {
- SCAClient client = (SCAClient) paymentNode;
+ SCAClient client = (SCAClient)paymentNode;
Payment payment = client.getService(Payment.class, "PaymentClient");
System.out.println("Result = " + payment.makePaymentMember("c-0", 100.00f));
}
diff --git a/sandbox/travelsample/contributions/payment-spring-policy/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java b/sandbox/travelsample/contributions/payment-spring-policy/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java
index d602f57dfc..4f64b20c4e 100644
--- a/sandbox/travelsample/contributions/payment-spring-policy/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java
+++ b/sandbox/travelsample/contributions/payment-spring-policy/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java
@@ -19,10 +19,11 @@
package scatours.payment.client.impl;
-import com.tuscanyscatours.payment.Payment;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
+import com.tuscanyscatours.payment.Payment;
+
@Service(Payment.class)
public class PaymentClientImpl implements Payment {
@Reference
diff --git a/sandbox/travelsample/contributions/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java b/sandbox/travelsample/contributions/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java
index a18dae7f93..42d995aa88 100644
--- a/sandbox/travelsample/contributions/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java
+++ b/sandbox/travelsample/contributions/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java
@@ -34,41 +34,42 @@ public class PaymentImpl implements Payment {
protected CreditCardPayment creditCardPayment;
protected EmailGateway emailGateway;
protected float transactionFee = 0;
-
+
//@Reference
public void setCreditCardPayment(CreditCardPayment creditCardPayment) {
this.creditCardPayment = creditCardPayment;
}
-
+
public void setEmailGateway(EmailGateway emailGateway) {
this.emailGateway = emailGateway;
}
-
+
//@Property
public void setTransactionFee(Float transactionFee) {
this.transactionFee = transactionFee;
}
-
+
public String makePaymentMember(String customerId, float amount) {
-
+
ObjectFactory objectFactory = new ObjectFactory();
CreditCardDetailsType ccDetails = objectFactory.createCreditCardDetailsType();
ccDetails.setCreditCardType(CreditCardTypeType.fromValue("Visa"));
PayerType ccOwner = objectFactory.createPayerType();
ccOwner.setName(customerId);
ccDetails.setCardOwner(ccOwner);
-
+
amount += transactionFee;
-
+
String status = creditCardPayment.authorize(ccDetails, amount);
-
- com.tuscanyscatours.emailgateway.ObjectFactory emailFactory = new com.tuscanyscatours.emailgateway.ObjectFactory();
+
+ com.tuscanyscatours.emailgateway.ObjectFactory emailFactory =
+ new com.tuscanyscatours.emailgateway.ObjectFactory();
EmailType email = emailFactory.createEmailType();
email.setTitle("Payment Received");
email.setTo(customerId);
-
+
emailGateway.sendEmail(email);
-
+
return status;
}
diff --git a/sandbox/travelsample/contributions/payment-spring-scatag/src/test/java/scatours/payment/PaymentTestCase.java b/sandbox/travelsample/contributions/payment-spring-scatag/src/test/java/scatours/payment/PaymentTestCase.java
index 4e3c7c57f6..29fda50ef3 100644
--- a/sandbox/travelsample/contributions/payment-spring-scatag/src/test/java/scatours/payment/PaymentTestCase.java
+++ b/sandbox/travelsample/contributions/payment-spring-scatag/src/test/java/scatours/payment/PaymentTestCase.java
@@ -19,7 +19,6 @@
package scatours.payment;
-import com.tuscanyscatours.payment.Payment;
import org.apache.tuscany.sca.node.SCAClient;
import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode;
@@ -28,6 +27,8 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import com.tuscanyscatours.payment.Payment;
+
/**
*
*/
@@ -36,22 +37,27 @@ public class PaymentTestCase {
private static SCANode creditCardNode;
@BeforeClass
- public static void setUpBeforeClass() throws Exception {
- creditCardNode = SCANodeFactory.newInstance().createSCANode("creditcard.composite",
- new SCAContribution("creditcard", "../creditcard-payment-jaxb/target/classes"));
-
+ public static void setUpBeforeClass() throws Exception {
+ creditCardNode =
+ SCANodeFactory.newInstance()
+ .createSCANode("creditcard.composite",
+ new SCAContribution("creditcard", "../creditcard-payment-jaxb/target/classes"));
+
creditCardNode.start();
-
- paymentNode = SCANodeFactory.newInstance().createSCANode(null,
- new SCAContribution("payment-spring-annotation", "./target/classes"),
- new SCAContribution("payment-spring-annotation-test", "./target/test-classes"));
+
+ paymentNode =
+ SCANodeFactory.newInstance().createSCANode(null,
+ new SCAContribution("payment-spring-annotation",
+ "./target/classes"),
+ new SCAContribution("payment-spring-annotation-test",
+ "./target/test-classes"));
paymentNode.start();
}
-
+
@Test
public void testPayment() {
- SCAClient client = (SCAClient) paymentNode;
+ SCAClient client = (SCAClient)paymentNode;
Payment payment = client.getService(Payment.class, "PaymentClient");
System.out.println("Result = " + payment.makePaymentMember("Fred", 100.00f));
}
diff --git a/sandbox/travelsample/contributions/payment-spring-scatag/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java b/sandbox/travelsample/contributions/payment-spring-scatag/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java
index d602f57dfc..4f64b20c4e 100644
--- a/sandbox/travelsample/contributions/payment-spring-scatag/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java
+++ b/sandbox/travelsample/contributions/payment-spring-scatag/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java
@@ -19,10 +19,11 @@
package scatours.payment.client.impl;
-import com.tuscanyscatours.payment.Payment;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
+import com.tuscanyscatours.payment.Payment;
+
@Service(Payment.class)
public class PaymentClientImpl implements Payment {
@Reference
diff --git a/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java b/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java
index fdced0d659..b08f76e0fa 100644
--- a/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java
+++ b/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java
@@ -19,7 +19,6 @@
package com.tuscanyscatours.customer;
-
public class CustomerNotFoundException extends Exception {
private static final long serialVersionUID = -129752837478357452L;
diff --git a/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java b/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java
index 6364701b9c..26926c7764 100644
--- a/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java
+++ b/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java
@@ -64,12 +64,12 @@ public class CustomerRegistryImpl implements CustomerRegistry {
cc.setExpYear(2012);
createCustomer("John Smith", "john@xyz.com", cc);
}
-
+
@Destroy
public void destroy() {
// Save the customers
}
-
+
public Customer createCustomer(String name, String email, CreditCardDetailsType creditCard) {
Customer customer = new Customer();
customer.setId("c-" + idGenerator++);
@@ -90,11 +90,11 @@ public class CustomerRegistryImpl implements CustomerRegistry {
public Customer getCustomer(String id) throws CustomerNotFoundException {
Customer customer = customers.get(id);
-
- if (customer == null){
+
+ if (customer == null) {
throw new CustomerNotFoundException("Customer " + id + " not found");
}
-
+
return customer;
}
diff --git a/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java b/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java
index 8dfe4b2b40..a35f761dc7 100644
--- a/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java
+++ b/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java
@@ -33,45 +33,45 @@ public class PaymentImpl implements Payment {
private CustomerRegistry customerRegistry;
private EmailGateway emailGateway;
private float transactionFee;
-
+
public void setCreditCardPayment(CreditCardPayment creditCardPayment) {
this.creditCardPayment = creditCardPayment;
}
-
+
public void setCustomerRegistry(CustomerRegistry customerRegistry) {
this.customerRegistry = customerRegistry;
- }
-
+ }
+
public void setEmailGateway(EmailGateway emailGateway) {
this.emailGateway = emailGateway;
}
-
+
public void setTransactionFee(Float transactionFee) {
this.transactionFee = transactionFee;
}
-
+
public String makePaymentMember(String customerId, float amount) {
try {
Customer customer = customerRegistry.getCustomer(customerId);
-
+
amount += transactionFee;
-
+
String status = creditCardPayment.authorize(customer.getCreditCard(), amount);
-
- com.tuscanyscatours.emailgateway.ObjectFactory emailFactory
- = new com.tuscanyscatours.emailgateway.ObjectFactory();
+
+ com.tuscanyscatours.emailgateway.ObjectFactory emailFactory =
+ new com.tuscanyscatours.emailgateway.ObjectFactory();
EmailType email = emailFactory.createEmailType();
email.setTitle("Payment Received");
email.setTo(customerId);
-
+
emailGateway.sendEmail(email);
-
+
return status;
} catch (CustomerNotFoundException ex) {
return "Payment failed due to " + ex.getMessage();
} catch (Throwable t) {
return "Payment failed due to system error " + t.getMessage();
- }
+ }
}
}
diff --git a/sandbox/travelsample/contributions/payment-spring/src/test/java/scatours/payment/PaymentTestCase.java b/sandbox/travelsample/contributions/payment-spring/src/test/java/scatours/payment/PaymentTestCase.java
index 23c60e5d35..8723c05624 100644
--- a/sandbox/travelsample/contributions/payment-spring/src/test/java/scatours/payment/PaymentTestCase.java
+++ b/sandbox/travelsample/contributions/payment-spring/src/test/java/scatours/payment/PaymentTestCase.java
@@ -19,7 +19,6 @@
package scatours.payment;
-import com.tuscanyscatours.payment.Payment;
import org.apache.tuscany.sca.node.SCAClient;
import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode;
@@ -28,6 +27,8 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import com.tuscanyscatours.payment.Payment;
+
/**
*
*/
@@ -36,22 +37,26 @@ public class PaymentTestCase {
private static SCANode creditCardNode;
@BeforeClass
- public static void setUpBeforeClass() throws Exception {
- creditCardNode = SCANodeFactory.newInstance().createSCANode("creditcard.composite",
- new SCAContribution("creditcard", "../creditcard-payment-jaxb/target/classes"));
-
+ public static void setUpBeforeClass() throws Exception {
+ creditCardNode =
+ SCANodeFactory.newInstance()
+ .createSCANode("creditcard.composite",
+ new SCAContribution("creditcard", "../creditcard-payment-jaxb/target/classes"));
+
creditCardNode.start();
-
- paymentNode = SCANodeFactory.newInstance().createSCANode(null,
- new SCAContribution("payment-spring", "./target/classes"),
- new SCAContribution("payment-spring-test", "./target/test-classes"));
+
+ paymentNode =
+ SCANodeFactory.newInstance().createSCANode(null,
+ new SCAContribution("payment-spring", "./target/classes"),
+ new SCAContribution("payment-spring-test",
+ "./target/test-classes"));
paymentNode.start();
}
-
+
@Test
public void testPayment() {
- SCAClient client = (SCAClient) paymentNode;
+ SCAClient client = (SCAClient)paymentNode;
Payment payment = client.getService(Payment.class, "PaymentClient");
System.out.println("Result = " + payment.makePaymentMember("c-0", 100.00f));
}
diff --git a/sandbox/travelsample/contributions/payment-spring/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java b/sandbox/travelsample/contributions/payment-spring/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java
index d602f57dfc..4f64b20c4e 100644
--- a/sandbox/travelsample/contributions/payment-spring/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java
+++ b/sandbox/travelsample/contributions/payment-spring/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java
@@ -19,10 +19,11 @@
package scatours.payment.client.impl;
-import com.tuscanyscatours.payment.Payment;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
+import com.tuscanyscatours.payment.Payment;
+
@Service(Payment.class)
public class PaymentClientImpl implements Payment {
@Reference
diff --git a/sandbox/travelsample/contributions/policy-client/src/main/java/scatours/client/TestClient.java b/sandbox/travelsample/contributions/policy-client/src/main/java/scatours/client/TestClient.java
index bb7cf0bdb0..b1858782cf 100644
--- a/sandbox/travelsample/contributions/policy-client/src/main/java/scatours/client/TestClient.java
+++ b/sandbox/travelsample/contributions/policy-client/src/main/java/scatours/client/TestClient.java
@@ -33,6 +33,6 @@ public class TestClient {
}
public void run() {
- System.out.println("TestClient - Successful Payment - Status = " + payment.makePaymentMember("c-0", 100.00f));
+ System.out.println("TestClient - Successful Payment - Status = " + payment.makePaymentMember("c-0", 100.00f));
}
}
diff --git a/sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursBooking.java b/sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursBooking.java
index 605745e0c8..a1e0d6c91f 100644
--- a/sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursBooking.java
+++ b/sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursBooking.java
@@ -18,7 +18,6 @@
*/
package com.tuscanyscatours;
-
import org.osoa.sca.annotations.Remotable;
import com.tuscanyscatours.common.TripItem;
diff --git a/sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursCart.java b/sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursCart.java
index 67764e1c0d..f9554342e9 100644
--- a/sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursCart.java
+++ b/sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursCart.java
@@ -26,8 +26,10 @@ import com.tuscanyscatours.common.TripItem;
* The ShoppingCart service interface
*/
@Remotable
-public interface SCAToursCart{
+public interface SCAToursCart {
String newCart();
+
TripItem[] getTrips(String cartId);
- void checkout(String cartId);
+
+ void checkout(String cartId);
}
diff --git a/sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/impl/SCAToursImpl.java b/sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/impl/SCAToursImpl.java
index e84d0b3191..7a7f6b460d 100644
--- a/sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/impl/SCAToursImpl.java
+++ b/sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/impl/SCAToursImpl.java
@@ -37,48 +37,48 @@ import com.tuscanyscatours.tripbooking.TripBooking;
* the outward facing bindings to be changed without changing the individual contributions
*/
@Scope("COMPOSITE")
-@Service(interfaces={SCAToursSearch.class, SCAToursBooking.class, SCAToursCart.class})
-public class SCAToursImpl implements SCAToursSearch, SCAToursBooking, SCAToursCart{
-
+@Service(interfaces = {SCAToursSearch.class, SCAToursBooking.class, SCAToursCart.class})
+public class SCAToursImpl implements SCAToursSearch, SCAToursBooking, SCAToursCart {
+
@Reference
protected TravelCatalogSearch travelCatalogSearch;
-
- @Reference
+
+ @Reference
protected TripBooking tripBooking;
-
- @Reference
- protected CartInitialize cartInitialize;
-
- @Reference
- protected CartCheckout cartCheckout;
-
+
+ @Reference
+ protected CartInitialize cartInitialize;
+
+ @Reference
+ protected CartCheckout cartCheckout;
+
// SCAToursSearch methods
-
+
public TripItem[] search(TripLeg tripLeg) {
return travelCatalogSearch.search(tripLeg);
- }
+ }
// SCAToursBooking methods
-
- public String bookTrip(String cartId, TripItem trip){
+
+ public String bookTrip(String cartId, TripItem trip) {
TripItem bookedTrip = tripBooking.bookTrip(cartId, trip);
return bookedTrip.getBookingCode();
}
-
+
// SCAToursCart methods
-
- public String newCart(){
+
+ public String newCart() {
String cartId = cartInitialize.newCart();
return cartId;
- }
-
- public TripItem[] getTrips(String cartId){
+ }
+
+ public TripItem[] getTrips(String cartId) {
return cartInitialize.getTrips(cartId);
}
-
- public void checkout(String cartId){
+
+ public void checkout(String cartId) {
// need to get the user id from the context here but
- // just make one up for the time being
+ // just make one up for the time being
cartCheckout.checkout(cartId, "c-0");
- }
+ }
}
diff --git a/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartCheckout.java b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartCheckout.java
index d14da414ef..929f9895c6 100644
--- a/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartCheckout.java
+++ b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartCheckout.java
@@ -22,5 +22,5 @@ import org.osoa.sca.annotations.Remotable;
@Remotable
public interface CartCheckout {
- void checkout(String cartId,String name);
+ void checkout(String cartId, String name);
}
diff --git a/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartInitialize.java b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartInitialize.java
index 916f7f7ed0..24affc4b23 100644
--- a/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartInitialize.java
+++ b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartInitialize.java
@@ -25,5 +25,6 @@ import com.tuscanyscatours.common.TripItem;
@Remotable
public interface CartInitialize {
String newCart();
+
TripItem[] getTrips(String cartId);
}
diff --git a/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartStore.java b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartStore.java
index 62e7da5a1f..c7d03d765b 100644
--- a/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartStore.java
+++ b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartStore.java
@@ -29,13 +29,13 @@ import com.tuscanyscatours.common.TripItem;
*/
@Remotable
@Conversational
-public interface CartStore{
+public interface CartStore {
void addTrip(TripItem trip);
-
+
void removeTrip(TripItem trip);
-
+
TripItem[] getTrips();
-
+
@EndsConversation
- void reset();
+ void reset();
}
diff --git a/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartUpdates.java b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartUpdates.java
index b3528e2ae1..f9a1272695 100644
--- a/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartUpdates.java
+++ b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartUpdates.java
@@ -24,6 +24,7 @@ import com.tuscanyscatours.common.TripItem;
@Remotable
public interface CartUpdates {
- void addTrip(String cartId,TripItem trip);
- void removeTrip(String cartId,TripItem trip);
+ void addTrip(String cartId, TripItem trip);
+
+ void removeTrip(String cartId, TripItem trip);
}
diff --git a/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/CartStoreImpl.java b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/CartStoreImpl.java
index 855e2d8371..460b962526 100644
--- a/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/CartStoreImpl.java
+++ b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/CartStoreImpl.java
@@ -24,49 +24,47 @@ import java.util.List;
import org.osoa.sca.annotations.ConversationID;
import org.osoa.sca.annotations.Destroy;
import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Scope;
import org.osoa.sca.annotations.Service;
import com.tuscanyscatours.common.TripItem;
-import com.tuscanyscatours.payment.Payment;
import com.tuscanyscatours.shoppingcart.CartStore;
/**
* An implementation of the CartStore service
*/
@Scope("CONVERSATION")
-@Service(interfaces={CartStore.class})
-public class CartStoreImpl implements CartStore{
+@Service(interfaces = {CartStore.class})
+public class CartStoreImpl implements CartStore {
@ConversationID
protected String cartId;
-
+
private List<TripItem> trips = new ArrayList<TripItem>();
-
+
@Init
public void initCart() {
System.out.println("CartStore init for id: " + cartId);
}
-
+
@Destroy
public void destroyCart() {
System.out.println("CartStore destroy for id: " + cartId);
}
-
+
public void addTrip(TripItem trip) {
trips.add(trip);
}
-
+
public void removeTrip(TripItem trip) {
trips.remove(trip);
}
-
- public TripItem[] getTrips(){
+
+ public TripItem[] getTrips() {
return trips.toArray(new TripItem[trips.size()]);
}
-
- public void reset(){
+
+ public void reset() {
trips.clear();
- }
+ }
}
diff --git a/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/ShoppingCartImpl.java b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/ShoppingCartImpl.java
index 5549d5cf7b..41c58e5266 100644
--- a/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/ShoppingCartImpl.java
+++ b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/ShoppingCartImpl.java
@@ -30,76 +30,75 @@ import org.osoa.sca.annotations.Service;
import com.tuscanyscatours.common.TripItem;
import com.tuscanyscatours.payment.Payment;
+import com.tuscanyscatours.shoppingcart.CartCheckout;
import com.tuscanyscatours.shoppingcart.CartInitialize;
import com.tuscanyscatours.shoppingcart.CartStore;
-import com.tuscanyscatours.shoppingcart.CartCheckout;
import com.tuscanyscatours.shoppingcart.CartUpdates;
/**
* An implementation of the ShoppingCart service
*/
-@Service(interfaces={CartInitialize.class, CartUpdates.class, CartCheckout.class})
-public class ShoppingCartImpl implements CartInitialize, CartUpdates, CartCheckout{
-
+@Service(interfaces = {CartInitialize.class, CartUpdates.class, CartCheckout.class})
+public class ShoppingCartImpl implements CartInitialize, CartUpdates, CartCheckout {
+
+ @Reference
+ protected Payment payment;
+
@Reference
- protected Payment payment;
-
- @Reference
protected CartStore cartStore;
-
+
@Context
- protected ComponentContext componentContext;
-
+ protected ComponentContext componentContext;
+
private static Map<String, CartStore> cartStores = new HashMap<String, CartStore>();
-
- public String newCart(){
+
+ public String newCart() {
String cartId = UUID.randomUUID().toString();
- ServiceReference<CartStore> cartStore = componentContext.getServiceReference(CartStore.class,
- "cartStore");
+ ServiceReference<CartStore> cartStore = componentContext.getServiceReference(CartStore.class, "cartStore");
cartStore.setConversationID(cartId);
cartStores.put(cartId, cartStore.getService());
-
+
return cartId;
- }
-
+ }
+
public void addTrip(String cartId, TripItem trip) {
- cartStores.get(cartId).addTrip(trip);
+ cartStores.get(cartId).addTrip(trip);
}
-
+
public void removeTrip(String cartId, TripItem trip) {
- cartStores.get(cartId).addTrip(trip);
+ cartStores.get(cartId).addTrip(trip);
}
-
- public TripItem[] getTrips(String cartId){
+
+ public TripItem[] getTrips(String cartId) {
return cartStores.get(cartId).getTrips();
}
-
- public void checkout(String cartId, String customerName){
+
+ public void checkout(String cartId, String customerName) {
// get users credentials. Hard coded for now but should
// come from the security context
String customerId = customerName;
-
+
// get the total for all the trips
float amount = (float)0.0;
-
+
TripItem[] trips = getTrips(cartId);
-
- for (TripItem trip : trips){
- if (trip.getType().equals(TripItem.TRIP)){
+
+ for (TripItem trip : trips) {
+ if (trip.getType().equals(TripItem.TRIP)) {
amount += trip.getPrice();
} else {
- for (TripItem tripItem : trip.getTripItems()){
+ for (TripItem tripItem : trip.getTripItems()) {
amount += tripItem.getPrice();
}
}
}
-
+
// Take the payment from the customer
payment.makePaymentMember(customerId, amount);
-
+
// reset the cart store
cartStores.get(cartId).reset();
cartStores.remove(cartId);
- }
-
+ }
+
}
diff --git a/sandbox/travelsample/contributions/travelcatalog/src/main/java/com/tuscanyscatours/travelcatalog/impl/TravelCatalogImpl.java b/sandbox/travelsample/contributions/travelcatalog/src/main/java/com/tuscanyscatours/travelcatalog/impl/TravelCatalogImpl.java
index 31e035bcdc..90351720bb 100644
--- a/sandbox/travelsample/contributions/travelcatalog/src/main/java/com/tuscanyscatours/travelcatalog/impl/TravelCatalogImpl.java
+++ b/sandbox/travelsample/contributions/travelcatalog/src/main/java/com/tuscanyscatours/travelcatalog/impl/TravelCatalogImpl.java
@@ -43,87 +43,85 @@ import com.tuscanyscatours.travelcatalog.TravelCatalogSearch;
* An implementation of the travel catalog service
*/
@Scope("COMPOSITE")
-@Service(interfaces={TravelCatalogSearch.class})
-public class TravelCatalogImpl implements TravelCatalogSearch, SearchCallback{
-
- @Reference
+@Service(interfaces = {TravelCatalogSearch.class})
+public class TravelCatalogImpl implements TravelCatalogSearch, SearchCallback {
+
+ @Reference
protected Search hotelSearch;
-
- @Reference
+
+ @Reference
protected Search flightSearch;
-
- @Reference
+
+ @Reference
protected Search carSearch;
-
- @Reference
- protected Search tripSearch;
-
+
+ @Reference
+ protected Search tripSearch;
+
@Property
public String quoteCurrencyCode = "USD";
-
+
@Reference
- protected CurrencyConverter currencyConverter;
-
+ protected CurrencyConverter currencyConverter;
+
@Context
protected ComponentContext componentContext;
-
+
private List<TripItem> searchResults = new ArrayList<TripItem>();
-
+
CountDownLatch resultsReceivedCountdown;
-
+
// TravelSearch methods
-
+
public TripItem[] search(TripLeg tripLeg) {
-
- resultsReceivedCountdown = new CountDownLatch(4);
+
+ resultsReceivedCountdown = new CountDownLatch(4);
searchResults.clear();
-
- ServiceReference<Search> dynamicHotelSearch =
- componentContext.getServiceReference(Search.class, "hotelSearch");
-
- dynamicHotelSearch.setCallbackID("HotelSearchCallbackID-" + tripLeg.getId());
+
+ ServiceReference<Search> dynamicHotelSearch = componentContext.getServiceReference(Search.class, "hotelSearch");
+
+ dynamicHotelSearch.setCallbackID("HotelSearchCallbackID-" + tripLeg.getId());
dynamicHotelSearch.getService().searchAsynch(tripLeg);
-
- flightSearch.searchAsynch(tripLeg);
+
+ flightSearch.searchAsynch(tripLeg);
carSearch.searchAsynch(tripLeg);
tripSearch.searchAsynch(tripLeg);
-
+
System.out.println("going into wait");
-
+
try {
- resultsReceivedCountdown.await();
- } catch (InterruptedException ex){
+ resultsReceivedCountdown.await();
+ } catch (InterruptedException ex) {
}
-
- for (TripItem tripItem : searchResults){
+
+ for (TripItem tripItem : searchResults) {
tripItem.setId(UUID.randomUUID().toString());
tripItem.setTripId(tripLeg.getId());
- tripItem.setPrice(currencyConverter.convert(tripItem.getCurrency(),
- quoteCurrencyCode,
- tripItem.getPrice()));
+ tripItem
+ .setPrice(currencyConverter.convert(tripItem.getCurrency(), quoteCurrencyCode, tripItem.getPrice()));
tripItem.setCurrency(quoteCurrencyCode);
}
-
+
return searchResults.toArray(new TripItem[searchResults.size()]);
}
-
+
// SearchCallback methods
-
- public synchronized void searchResults(TripItem[] items){
+
+ public synchronized void searchResults(TripItem[] items) {
RequestContext requestContext = componentContext.getRequestContext();
Object callbackID = requestContext.getServiceReference().getCallbackID();
System.out.println("Asynch response - " + callbackID);
-
+
if (items != null) {
- for(int i = 0; i < items.length; i++ ){
+ for (int i = 0; i < items.length; i++) {
searchResults.add(items[i]);
}
}
-
+
resultsReceivedCountdown.countDown();
- }
-
- public void setPercentComplete(String searchComponent, int percentComplete){
+ }
+
+ public void setPercentComplete(String searchComponent, int percentComplete) {
// Not used at the moment
}
}
diff --git a/sandbox/travelsample/contributions/trip/src/main/java/com/tuscanyscatours/trip/impl/TripImpl.java b/sandbox/travelsample/contributions/trip/src/main/java/com/tuscanyscatours/trip/impl/TripImpl.java
index c4fd0df05d..ec90524518 100644
--- a/sandbox/travelsample/contributions/trip/src/main/java/com/tuscanyscatours/trip/impl/TripImpl.java
+++ b/sandbox/travelsample/contributions/trip/src/main/java/com/tuscanyscatours/trip/impl/TripImpl.java
@@ -36,82 +36,59 @@ import com.tuscanyscatours.common.TripLeg;
* An implementation of the Trip service
*/
@Scope("STATELESS")
-@Service(interfaces={Search.class, Book.class})
+@Service(interfaces = {Search.class, Book.class})
public class TripImpl implements Search, Book {
-
+
private List<TripInfo> trips = new ArrayList<TripInfo>();
-
+
@Callback
- protected SearchCallback searchCallback;
+ protected SearchCallback searchCallback;
@Init
public void init() {
- trips.add(new TripInfo("FS1DEC06",
- "Florence and Siena pre-packaged tour",
- "LGW",
- "FLR",
- "06/12/09",
- "13/12/09",
- "27",
- 450,
- "EUR",
- "http://localhost:8085/tbd" ));
- trips.add(new TripInfo("FS1DEC13",
- "Florence and Siena pre-packaged tour 2",
- "LGW",
- "FLR",
- "13/12/09",
- "20/12/09",
- "27",
- 550,
- "EUR",
- "http://localhost:8085/tbd" ));
+ trips.add(new TripInfo("FS1DEC06", "Florence and Siena pre-packaged tour", "LGW", "FLR", "06/12/09",
+ "13/12/09", "27", 450, "EUR", "http://localhost:8085/tbd"));
+ trips.add(new TripInfo("FS1DEC13", "Florence and Siena pre-packaged tour 2", "LGW", "FLR", "13/12/09",
+ "20/12/09", "27", 550, "EUR", "http://localhost:8085/tbd"));
}
-
+
public TripItem[] searchSynch(TripLeg tripLeg) {
List<TripItem> items = new ArrayList<TripItem>();
-
+
// find the pre-package trip
- for(TripInfo trip : trips){
- if ((trip.getFromLocation().equals(tripLeg.getFromLocation())) &&
- (trip.getToLocation().equals(tripLeg.getToLocation())) &&
- (trip.getFromDate().equals(tripLeg.getFromDate()))){
- TripItem item = new TripItem("",
- "",
- TripItem.TRIP,
- trip.getName(),
- trip.getDescription(),
- trip.getFromLocation() + " - " + trip.getToLocation(),
- trip.getFromDate(),
- trip.getToDate(),
- trip.getPricePerPerson(),
- trip.getCurrency(),
- trip.getLink());
+ for (TripInfo trip : trips) {
+ if ((trip.getFromLocation().equals(tripLeg.getFromLocation())) && (trip.getToLocation().equals(tripLeg
+ .getToLocation()))
+ && (trip.getFromDate().equals(tripLeg.getFromDate()))) {
+ TripItem item =
+ new TripItem("", "", TripItem.TRIP, trip.getName(), trip.getDescription(),
+ trip.getFromLocation() + " - " + trip.getToLocation(), trip.getFromDate(), trip
+ .getToDate(), trip.getPricePerPerson(), trip.getCurrency(), trip.getLink());
items.add(item);
}
- }
-
+ }
+
return items.toArray(new TripItem[items.size()]);
}
-
+
public void searchAsynch(TripLeg tripLeg) {
- System.out.println("Starting trip search");
-
- try {
- Thread.sleep(2000);
- } catch(Exception ex){
- // do nothing
+ System.out.println("Starting trip search");
+
+ try {
+ Thread.sleep(2000);
+ } catch (Exception ex) {
+ // do nothing
}
-
+
// return available hotels
- searchCallback.searchResults(searchSynch(tripLeg));
+ searchCallback.searchResults(searchSynch(tripLeg));
}
-
- public int getPercentComplete(){
+
+ public int getPercentComplete() {
return 100;
}
-
+
public String book(TripItem tripItem) {
return "trip1";
- }
+ }
}
diff --git a/sandbox/travelsample/contributions/trip/src/main/java/com/tuscanyscatours/trip/impl/TripInfo.java b/sandbox/travelsample/contributions/trip/src/main/java/com/tuscanyscatours/trip/impl/TripInfo.java
index d236c1243f..d8809e1325 100644
--- a/sandbox/travelsample/contributions/trip/src/main/java/com/tuscanyscatours/trip/impl/TripInfo.java
+++ b/sandbox/travelsample/contributions/trip/src/main/java/com/tuscanyscatours/trip/impl/TripInfo.java
@@ -19,9 +19,8 @@
package com.tuscanyscatours.trip.impl;
-
public class TripInfo {
-
+
private String name;
private String description;
private String fromLocation;
@@ -32,12 +31,12 @@ public class TripInfo {
private double pricePerPerson;
private String currency;
private String link;
-
+
public TripInfo() {
- }
-
- public TripInfo(String name,
- String description,
+ }
+
+ public TripInfo(String name,
+ String description,
String fromLocation,
String toLocation,
String fromDate,
@@ -47,7 +46,6 @@ public class TripInfo {
String currency,
String link) {
-
this.name = name;
this.description = description;
this.fromLocation = fromLocation;
@@ -58,85 +56,85 @@ public class TripInfo {
this.pricePerPerson = pricePerPerson;
this.currency = currency;
this.link = link;
- }
-
+ }
+
public String getName() {
return name;
}
-
+
public void setName(String name) {
this.name = name;
- }
-
+ }
+
public String getDescription() {
return description;
}
-
+
public void setDescription(String description) {
- this.description = description;
- }
-
+ this.description = description;
+ }
+
public String getFromLocation() {
return fromLocation;
}
-
+
public void setFromLocation(String fromLocation) {
this.fromLocation = fromLocation;
}
-
+
public String getToLocation() {
return toLocation;
- }
-
+ }
+
public void setToLocation(String toLocation) {
this.toLocation = toLocation;
}
-
+
public String getFromDate() {
return fromDate;
}
-
+
public void setFromDate(String fromDate) {
this.fromDate = fromDate;
}
-
+
public String getToDate() {
return toDate;
}
-
+
public void setToDate(String toDate) {
this.toDate = toDate;
}
-
+
public String getSpaces() {
return spaces;
}
-
+
public void setSpaces(String spaces) {
this.spaces = spaces;
}
-
+
public double getPricePerPerson() {
return pricePerPerson;
}
-
+
public void setPricePerPerson(double pricePerPerson) {
this.pricePerPerson = pricePerPerson;
}
-
+
public String getCurrency() {
return currency;
}
-
+
public void setCurrency(String currency) {
this.currency = currency;
}
-
+
public String getLink() {
return link;
}
-
+
public void setLink(String link) {
this.link = link;
}
-} \ No newline at end of file
+}
diff --git a/sandbox/travelsample/contributions/trip/src/test/java/scatours/trip/TripTestCase.java b/sandbox/travelsample/contributions/trip/src/test/java/scatours/trip/TripTestCase.java
index 88df6f4c2e..fd2cc073ec 100644
--- a/sandbox/travelsample/contributions/trip/src/test/java/scatours/trip/TripTestCase.java
+++ b/sandbox/travelsample/contributions/trip/src/test/java/scatours/trip/TripTestCase.java
@@ -34,37 +34,29 @@ import com.tuscanyscatours.common.TripItem;
*
*/
public class TripTestCase {
- private static SCANode tripNode;
+ private static SCANode tripNode;
@BeforeClass
- public static void setUpBeforeClass() throws Exception {
- try {
- tripNode = SCANodeFactory.newInstance().createSCANode("trip.composite",
- new SCAContribution("trip", "./target/classes"),
- new SCAContribution("trip-test", "./target/test-classes"));
-
+ public static void setUpBeforeClass() throws Exception {
+ try {
+ tripNode =
+ SCANodeFactory.newInstance().createSCANode("trip.composite",
+ new SCAContribution("trip", "./target/classes"),
+ new SCAContribution("trip-test", "./target/test-classes"));
tripNode.start();
} catch (Exception ex) {
ex.printStackTrace();
}
}
-
+
@Test
public void testPayment() {
- SCAClient client = (SCAClient) tripNode;
+ SCAClient client = (SCAClient)tripNode;
Book booking = client.getService(Book.class, "Trip/Book");
- TripItem tripItem = new TripItem("1234",
- "5678",
- TripItem.TRIP,
- "FS1DEC06",
- "Florence and Siena pre-packaged tour",
- "FLR",
- "06/12/09",
- "13/12/09",
- 450,
- "EUR",
- "http://localhost:8085/tbd");
+ TripItem tripItem =
+ new TripItem("1234", "5678", TripItem.TRIP, "FS1DEC06", "Florence and Siena pre-packaged tour", "FLR",
+ "06/12/09", "13/12/09", 450, "EUR", "http://localhost:8085/tbd");
System.out.println("Result = " + booking.book(tripItem) + "\n");
}
diff --git a/sandbox/travelsample/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/TripBooking.java b/sandbox/travelsample/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/TripBooking.java
index f866c6208f..0693d40465 100644
--- a/sandbox/travelsample/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/TripBooking.java
+++ b/sandbox/travelsample/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/TripBooking.java
@@ -27,6 +27,6 @@ import com.tuscanyscatours.common.TripItem;
*/
@Remotable
public interface TripBooking {
-
+
TripItem bookTrip(String cartId, TripItem trip);
}
diff --git a/sandbox/travelsample/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/impl/TripBookingImpl.java b/sandbox/travelsample/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/impl/TripBookingImpl.java
index d5dfca951c..5d1e1f2db5 100644
--- a/sandbox/travelsample/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/impl/TripBookingImpl.java
+++ b/sandbox/travelsample/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/impl/TripBookingImpl.java
@@ -32,61 +32,60 @@ import com.tuscanyscatours.tripbooking.TripBooking;
/**
* An implementation of the TripBooking service
*/
-@Service(interfaces={TripBooking.class})
-public class TripBookingImpl implements TripBooking{
+@Service(interfaces = {TripBooking.class})
+public class TripBookingImpl implements TripBooking {
- @Reference
+ @Reference
protected Book hotelBook;
-
- @Reference
+
+ @Reference
protected Book flightBook;
-
- @Reference
+
+ @Reference
protected Book carBook;
-
- @Reference
- protected Book tripBook;
-
- @Reference
+
+ @Reference
+ protected Book tripBook;
+
+ @Reference
protected CartUpdates cartUpdates;
-
+
@Context
- protected ComponentContext componentContext;
-
+ protected ComponentContext componentContext;
+
public TripItem bookTrip(String cartId, TripItem trip) {
-
+
String bookingCode = "";
-
+
// book any nested items
TripItem[] nestedItems = trip.getTripItems();
- if (nestedItems != null){
- for(int i = 0; i < nestedItems.length; i++ ){
+ if (nestedItems != null) {
+ for (int i = 0; i < nestedItems.length; i++) {
TripItem tripItem = nestedItems[i];
- if (tripItem.getType().equals(TripItem.CAR)){
+ if (tripItem.getType().equals(TripItem.CAR)) {
tripItem.setBookingCode(carBook.book(tripItem));
- } else if (tripItem.getType().equals(TripItem.FLIGHT)){
+ } else if (tripItem.getType().equals(TripItem.FLIGHT)) {
tripItem.setBookingCode(flightBook.book(tripItem));
- } else if (tripItem.getType().equals(TripItem.HOTEL)){
+ } else if (tripItem.getType().equals(TripItem.HOTEL)) {
tripItem.setBookingCode(hotelBook.book(tripItem));
} else {
tripItem.setBookingCode(tripItem.getType() + " is invalid");
}
}
}
-
+
// book the top level item if it's a packaged trip
- if (trip.getType().equals(TripItem.TRIP)){
+ if (trip.getType().equals(TripItem.TRIP)) {
bookingCode = tripBook.book(trip);
trip.setBookingCode(bookingCode);
}
-
+
// add trip to the shopping cart
- ServiceReference<CartUpdates> cart = componentContext.getServiceReference(CartUpdates.class,
- "cartUpdates");
+ ServiceReference<CartUpdates> cart = componentContext.getServiceReference(CartUpdates.class, "cartUpdates");
cart.setConversationID(cartId);
cart.getService().addTrip(cartId, trip);
-
+
return trip;
}
-
+
}
diff --git a/sandbox/travelsample/launchers/blog-feed/src/main/java/scatours/BlogFeedLauncher.java b/sandbox/travelsample/launchers/blog-feed/src/main/java/scatours/BlogFeedLauncher.java
index 54d94ec046..8dc6956986 100644
--- a/sandbox/travelsample/launchers/blog-feed/src/main/java/scatours/BlogFeedLauncher.java
+++ b/sandbox/travelsample/launchers/blog-feed/src/main/java/scatours/BlogFeedLauncher.java
@@ -28,11 +28,9 @@ import org.apache.tuscany.sca.node.SCANodeFactory;
public class BlogFeedLauncher {
public static void main(String[] args) throws Exception {
- SCAContribution feedContribution =
- locate("blog-feed");
+ SCAContribution feedContribution = locate("blog-feed");
- SCANode node = SCANodeFactory.newInstance().createSCANode(
- "blog-feed.composite", feedContribution);
+ SCANode node = SCANodeFactory.newInstance().createSCANode("blog-feed.composite", feedContribution);
node.start();
System.out.println("Node started - Press enter to shutdown.");
diff --git a/sandbox/travelsample/launchers/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBALauncher.java b/sandbox/travelsample/launchers/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBALauncher.java
index d18acc6df1..0f9d0eca80 100644
--- a/sandbox/travelsample/launchers/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBALauncher.java
+++ b/sandbox/travelsample/launchers/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBALauncher.java
@@ -31,22 +31,19 @@ import scatours.currencyconverter.CurrencyConverter;
public class CurrencyConverterCORBALauncher {
public static void main(String[] args) throws Exception {
- SCAContribution currencyCORBAContribution =
- locate("currency-corba");
- SCAContribution currencyContribution =
- locate("currency");
-
- SCANode node = SCANodeFactory.newInstance().createSCANode(
- "currency-converter-corba.composite", currencyContribution, currencyCORBAContribution);
+ SCAContribution currencyCORBAContribution = locate("currency-corba");
+ SCAContribution currencyContribution = locate("currency");
+
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("currency-converter-corba.composite",
+ currencyContribution,
+ currencyCORBAContribution);
node.start();
System.out.println("Quick currency converter test");
- CurrencyConverter converter = ((SCAClient)node).getService(
- CurrencyConverter.class, "CurrencyConverter");
- System.out.println("USD -> GBP = "
- + converter.getExchangeRate("USD", "GBP"));
- System.out.println("100 USD = "
- + converter.convert("USD", "GBP", 100) + "GBP");
+ CurrencyConverter converter = ((SCAClient)node).getService(CurrencyConverter.class, "CurrencyConverter");
+ System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
+ System.out.println("100 USD = " + converter.convert("USD", "GBP", 100) + "GBP");
System.out.println("Node started - Press enter to shutdown.");
System.in.read();
diff --git a/sandbox/travelsample/launchers/currency-converter-corba/src/main/java/scatours/currencyconverter/CurrencyConverter.java b/sandbox/travelsample/launchers/currency-converter-corba/src/main/java/scatours/currencyconverter/CurrencyConverter.java
index 6d0efc8c66..fe5c98bf02 100644
--- a/sandbox/travelsample/launchers/currency-converter-corba/src/main/java/scatours/currencyconverter/CurrencyConverter.java
+++ b/sandbox/travelsample/launchers/currency-converter-corba/src/main/java/scatours/currencyconverter/CurrencyConverter.java
@@ -26,11 +26,8 @@ import org.osoa.sca.annotations.Remotable;
@Remotable
public interface CurrencyConverter {
- double getExchangeRate(String fromCurrencyCode,
- String toCurrencyCode);
-
- double convert(String fromCurrencyCode,
- String toCurrencyCode,
- double amount);
+ double getExchangeRate(String fromCurrencyCode, String toCurrencyCode);
+
+ double convert(String fromCurrencyCode, String toCurrencyCode, double amount);
}
diff --git a/sandbox/travelsample/launchers/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSLauncher.java b/sandbox/travelsample/launchers/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSLauncher.java
index 08a0d8430a..9de41eb478 100644
--- a/sandbox/travelsample/launchers/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSLauncher.java
+++ b/sandbox/travelsample/launchers/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSLauncher.java
@@ -31,8 +31,10 @@ public class CurrencyConverterJMSLauncher {
SCAContribution currencyJMSContribution = locate("currency-jms");
SCAContribution currencyContribution = locate("currency");
- SCANode node = SCANodeFactory.newInstance().createSCANode(
- "currency-converter-jms.composite", currencyContribution, currencyJMSContribution);
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("currency-converter-jms.composite",
+ currencyContribution,
+ currencyJMSContribution);
node.start();
System.out.println("Node started - Press enter to shutdown.");
diff --git a/sandbox/travelsample/launchers/currency-converter-jms/src/main/java/scatours/JMSBrokerLauncher.java b/sandbox/travelsample/launchers/currency-converter-jms/src/main/java/scatours/JMSBrokerLauncher.java
index 7d063ca865..929eb78431 100644
--- a/sandbox/travelsample/launchers/currency-converter-jms/src/main/java/scatours/JMSBrokerLauncher.java
+++ b/sandbox/travelsample/launchers/currency-converter-jms/src/main/java/scatours/JMSBrokerLauncher.java
@@ -23,16 +23,16 @@ import org.apache.activemq.broker.BrokerService;
public class JMSBrokerLauncher {
public static void main(String[] args) throws Exception {
- final BrokerService jmsBroker = new BrokerService();
- jmsBroker.setPersistent(false);
- jmsBroker.setUseJmx(false);
- jmsBroker.addConnector("tcp://localhost:61619");
- jmsBroker.start();
+ final BrokerService jmsBroker = new BrokerService();
+ jmsBroker.setPersistent(false);
+ jmsBroker.setUseJmx(false);
+ jmsBroker.addConnector("tcp://localhost:61619");
+ jmsBroker.start();
- System.out.println("JMS Message Broker started");
- System.out.println("Press enter to shutdown.");
- System.in.read();
+ System.out.println("JMS Message Broker started");
+ System.out.println("Press enter to shutdown.");
+ System.in.read();
- jmsBroker.stop();
+ jmsBroker.stop();
}
- }
+}
diff --git a/sandbox/travelsample/launchers/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java b/sandbox/travelsample/launchers/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java
index 24d945b2f4..b1f783bfba 100644
--- a/sandbox/travelsample/launchers/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java
+++ b/sandbox/travelsample/launchers/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java
@@ -26,11 +26,8 @@ import org.osoa.sca.annotations.Remotable;
@Remotable
public interface CurrencyConverter {
- double getExchangeRate(String fromCurrencyCode,
- String toCurrencyCode);
-
- double convert(String fromCurrencyCode,
- String toCurrencyCode,
- double amount);
+ double getExchangeRate(String fromCurrencyCode, String toCurrencyCode);
+
+ double convert(String fromCurrencyCode, String toCurrencyCode, double amount);
}
diff --git a/sandbox/travelsample/launchers/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMILauncher.java b/sandbox/travelsample/launchers/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMILauncher.java
index 87660bdfb6..b509cfef5c 100644
--- a/sandbox/travelsample/launchers/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMILauncher.java
+++ b/sandbox/travelsample/launchers/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMILauncher.java
@@ -31,22 +31,19 @@ import com.tuscanyscatours.currencyconverter.CurrencyConverter;
public class CurrencyConverterRMILauncher {
public static void main(String[] args) throws Exception {
- SCAContribution currencyRMIContribution =
- locate("currency-rmi");
- SCAContribution currencyContribution =
- locate("currency");
-
- SCANode node = SCANodeFactory.newInstance().createSCANode(
- "currency-converter-rmi.composite", currencyContribution, currencyRMIContribution);
+ SCAContribution currencyRMIContribution = locate("currency-rmi");
+ SCAContribution currencyContribution = locate("currency");
+
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("currency-converter-rmi.composite",
+ currencyContribution,
+ currencyRMIContribution);
node.start();
System.out.println("Quick currency converter test");
- CurrencyConverter converter = ((SCAClient)node).getService(
- CurrencyConverter.class, "CurrencyConverter");
- System.out.println("USD -> GBP = "
- + converter.getExchangeRate("USD", "GBP"));
- System.out.println("100 USD = "
- + converter.convert("USD", "GBP", 100) + "GBP");
+ CurrencyConverter converter = ((SCAClient)node).getService(CurrencyConverter.class, "CurrencyConverter");
+ System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
+ System.out.println("100 USD = " + converter.convert("USD", "GBP", 100) + "GBP");
System.out.println("Node started - Press enter to shutdown.");
System.in.read();
diff --git a/sandbox/travelsample/launchers/currency-converter-ws/src/main/java/scatours/CurrencyConverterWSLauncher.java b/sandbox/travelsample/launchers/currency-converter-ws/src/main/java/scatours/CurrencyConverterWSLauncher.java
index 36b907d454..2425d3f483 100644
--- a/sandbox/travelsample/launchers/currency-converter-ws/src/main/java/scatours/CurrencyConverterWSLauncher.java
+++ b/sandbox/travelsample/launchers/currency-converter-ws/src/main/java/scatours/CurrencyConverterWSLauncher.java
@@ -31,22 +31,19 @@ import scatours.currencyconverter.CurrencyConverter;
public class CurrencyConverterWSLauncher {
public static void main(String[] args) throws Exception {
- SCAContribution currencyWSContribution =
- locate("currency-ws");
- SCAContribution currencyContribution =
- locate("currency");
-
- SCANode node = SCANodeFactory.newInstance().createSCANode(
- "currency-converter-ws.composite", currencyContribution, currencyWSContribution);
+ SCAContribution currencyWSContribution = locate("currency-ws");
+ SCAContribution currencyContribution = locate("currency");
+
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("currency-converter-ws.composite",
+ currencyContribution,
+ currencyWSContribution);
node.start();
System.out.println("Quick currency converter test");
- CurrencyConverter converter = ((SCAClient)node).getService(
- CurrencyConverter.class, "CurrencyConverter");
- System.out.println("USD -> GBP = "
- + converter.getExchangeRate("USD", "GBP"));
- System.out.println("100 USD = "
- + converter.convert("USD", "GBP", 100) + "GBP");
+ CurrencyConverter converter = ((SCAClient)node).getService(CurrencyConverter.class, "CurrencyConverter");
+ System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
+ System.out.println("100 USD = " + converter.convert("USD", "GBP", 100) + "GBP");
System.out.println("Node started - Press enter to shutdown.");
System.in.read();
diff --git a/sandbox/travelsample/launchers/currency-converter-ws/src/main/java/scatours/currencyconverter/CurrencyConverter.java b/sandbox/travelsample/launchers/currency-converter-ws/src/main/java/scatours/currencyconverter/CurrencyConverter.java
index 6d0efc8c66..fe5c98bf02 100644
--- a/sandbox/travelsample/launchers/currency-converter-ws/src/main/java/scatours/currencyconverter/CurrencyConverter.java
+++ b/sandbox/travelsample/launchers/currency-converter-ws/src/main/java/scatours/currencyconverter/CurrencyConverter.java
@@ -26,11 +26,8 @@ import org.osoa.sca.annotations.Remotable;
@Remotable
public interface CurrencyConverter {
- double getExchangeRate(String fromCurrencyCode,
- String toCurrencyCode);
-
- double convert(String fromCurrencyCode,
- String toCurrencyCode,
- double amount);
+ double getExchangeRate(String fromCurrencyCode, String toCurrencyCode);
+
+ double convert(String fromCurrencyCode, String toCurrencyCode, double amount);
}
diff --git a/sandbox/travelsample/launchers/currency-converter/src/main/java/scatours/CurrencyConverterLauncher.java b/sandbox/travelsample/launchers/currency-converter/src/main/java/scatours/CurrencyConverterLauncher.java
index 9e8385e9af..cacd579b3b 100644
--- a/sandbox/travelsample/launchers/currency-converter/src/main/java/scatours/CurrencyConverterLauncher.java
+++ b/sandbox/travelsample/launchers/currency-converter/src/main/java/scatours/CurrencyConverterLauncher.java
@@ -31,20 +31,15 @@ import scatours.currencyconverter.CurrencyConverter;
public class CurrencyConverterLauncher {
public static void main(String[] args) throws Exception {
- SCAContribution currencyContribution =
- locate("currency");
-
- SCANode node = SCANodeFactory.newInstance().createSCANode(
- "currency-converter.composite", currencyContribution);
+ SCAContribution currencyContribution = locate("currency");
+
+ SCANode node = SCANodeFactory.newInstance().createSCANode("currency-converter.composite", currencyContribution);
node.start();
System.out.println("Quick currency converter test");
- CurrencyConverter converter = ((SCAClient)node).getService(
- CurrencyConverter.class, "CurrencyConverter");
- System.out.println("USD -> GBP = "
- + converter.getExchangeRate("USD", "GBP"));
- System.out.println("100 USD = "
- + converter.convert("USD", "GBP", 100) + "GBP");
+ CurrencyConverter converter = ((SCAClient)node).getService(CurrencyConverter.class, "CurrencyConverter");
+ System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
+ System.out.println("100 USD = " + converter.convert("USD", "GBP", 100) + "GBP");
System.out.println("Node started - Press enter to shutdown.");
System.in.read();
diff --git a/sandbox/travelsample/launchers/currency-converter/src/main/java/scatours/currencyconverter/CurrencyConverter.java b/sandbox/travelsample/launchers/currency-converter/src/main/java/scatours/currencyconverter/CurrencyConverter.java
index 6d0efc8c66..fe5c98bf02 100644
--- a/sandbox/travelsample/launchers/currency-converter/src/main/java/scatours/currencyconverter/CurrencyConverter.java
+++ b/sandbox/travelsample/launchers/currency-converter/src/main/java/scatours/currencyconverter/CurrencyConverter.java
@@ -26,11 +26,8 @@ import org.osoa.sca.annotations.Remotable;
@Remotable
public interface CurrencyConverter {
- double getExchangeRate(String fromCurrencyCode,
- String toCurrencyCode);
-
- double convert(String fromCurrencyCode,
- String toCurrencyCode,
- double amount);
+ double getExchangeRate(String fromCurrencyCode, String toCurrencyCode);
+
+ double convert(String fromCurrencyCode, String toCurrencyCode, double amount);
}
diff --git a/sandbox/travelsample/launchers/databinding/src/main/java/scatours/DatabindingLauncher.java b/sandbox/travelsample/launchers/databinding/src/main/java/scatours/DatabindingLauncher.java
index 1ae22baca6..61f6b74582 100644
--- a/sandbox/travelsample/launchers/databinding/src/main/java/scatours/DatabindingLauncher.java
+++ b/sandbox/travelsample/launchers/databinding/src/main/java/scatours/DatabindingLauncher.java
@@ -27,19 +27,16 @@ import org.apache.tuscany.sca.node.SCANodeFactory;
public class DatabindingLauncher {
public static void main(String[] args) throws Exception {
- SCANode node1 = SCANodeFactory.newInstance().createSCANode(null,
- locate("paymentjava"),
- locate("client"));
-
- SCANode node2 = SCANodeFactory.newInstance().createSCANode(null,
- locate("creditcardpaymentsdo"));
-
+ SCANode node1 = SCANodeFactory.newInstance().createSCANode(null, locate("paymentjava"), locate("client"));
+
+ SCANode node2 = SCANodeFactory.newInstance().createSCANode(null, locate("creditcardpaymentsdo"));
+
node1.start();
node2.start();
Runnable runner = ((SCAClient)node1).getService(Runnable.class, "TestClient/Runnable");
runner.run();
-
+
node1.stop();
node2.stop();
}
diff --git a/sandbox/travelsample/launchers/feed-logger/src/main/java/scatours/FeedLoggerLauncher.java b/sandbox/travelsample/launchers/feed-logger/src/main/java/scatours/FeedLoggerLauncher.java
index 73970b12ca..4aea24dbfe 100644
--- a/sandbox/travelsample/launchers/feed-logger/src/main/java/scatours/FeedLoggerLauncher.java
+++ b/sandbox/travelsample/launchers/feed-logger/src/main/java/scatours/FeedLoggerLauncher.java
@@ -31,15 +31,12 @@ import scatours.feedlogger.FeedLogger;
public class FeedLoggerLauncher {
public static void main(String[] args) throws Exception {
- SCAContribution feedContribution =
- locate("feed-logger");
+ SCAContribution feedContribution = locate("feed-logger");
- SCANode node = SCANodeFactory.newInstance().createSCANode(
- "feed-logger.composite", feedContribution);
+ SCANode node = SCANodeFactory.newInstance().createSCANode("feed-logger.composite", feedContribution);
node.start();
-
- FeedLogger logger = ((SCAClient)node).getService(
- FeedLogger.class, "FeedLogger");
+
+ FeedLogger logger = ((SCAClient)node).getService(FeedLogger.class, "FeedLogger");
logger.logFeeds(5);
node.stop();
diff --git a/sandbox/travelsample/launchers/fullapp-nodes/src/main/java/scatours/FullAppNodesLauncher.java b/sandbox/travelsample/launchers/fullapp-nodes/src/main/java/scatours/FullAppNodesLauncher.java
index 6367bb60f3..3b9a2b5f90 100644
--- a/sandbox/travelsample/launchers/fullapp-nodes/src/main/java/scatours/FullAppNodesLauncher.java
+++ b/sandbox/travelsample/launchers/fullapp-nodes/src/main/java/scatours/FullAppNodesLauncher.java
@@ -25,27 +25,34 @@ import org.apache.tuscany.sca.node.SCANode;
import org.apache.tuscany.sca.node.SCANodeFactory;
public class FullAppNodesLauncher {
-
+
public static void main(String[] args) throws Exception {
- SCANode nodeCreditcard = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/creditcard");
+ SCANode nodeCreditcard =
+ SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/creditcard");
nodeCreditcard.start();
- SCANode nodePayment = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/payment");
- nodePayment.start();
+ SCANode nodePayment =
+ SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/payment");
+ nodePayment.start();
- SCANode nodeShoppingcart = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/shoppingcart");
- nodeShoppingcart.start();
+ SCANode nodeShoppingcart =
+ SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/shoppingcart");
+ nodeShoppingcart.start();
- SCANode nodeCurrency = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/currency");
+ SCANode nodeCurrency =
+ SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/currency");
nodeCurrency.start();
- SCANode nodePackagedtrip = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/packagedtrip");
- nodePackagedtrip.start();
+ SCANode nodePackagedtrip =
+ SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/packagedtrip");
+ nodePackagedtrip.start();
- SCANode nodeBespoketrip = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/bespoketrip");
+ SCANode nodeBespoketrip =
+ SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/bespoketrip");
nodeBespoketrip.start();
- SCANode nodeFrontend = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/frontend");
+ SCANode nodeFrontend =
+ SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/frontend");
nodeFrontend.start();
SCANode nodeUI = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/ui");
@@ -55,14 +62,15 @@ public class FullAppNodesLauncher {
try {
System.in.read();
- } catch (IOException e) {}
+ } catch (IOException e) {
+ }
nodeCreditcard.stop();
nodePayment.stop();
nodeShoppingcart.stop();
nodeCurrency.stop();
nodePackagedtrip.stop();
- nodeBespoketrip.stop();
+ nodeBespoketrip.stop();
nodeFrontend.stop();
nodeUI.stop();
}
diff --git a/sandbox/travelsample/launchers/fullapp/src/main/java/scatours/FullAppLauncher.java b/sandbox/travelsample/launchers/fullapp/src/main/java/scatours/FullAppLauncher.java
index e9496eef8e..5e533c77c6 100644
--- a/sandbox/travelsample/launchers/fullapp/src/main/java/scatours/FullAppLauncher.java
+++ b/sandbox/travelsample/launchers/fullapp/src/main/java/scatours/FullAppLauncher.java
@@ -28,7 +28,6 @@ import org.apache.tuscany.sca.node.SCANodeFactory;
public class FullAppLauncher {
-
public static void main(String[] args) throws Exception {
SCANode node =
SCANodeFactory.newInstance().createSCANode(null,
diff --git a/sandbox/travelsample/launchers/help-pages/src/main/java/scatours/HelpPagesLauncher.java b/sandbox/travelsample/launchers/help-pages/src/main/java/scatours/HelpPagesLauncher.java
index 097e05e7e5..a72f5c4c54 100644
--- a/sandbox/travelsample/launchers/help-pages/src/main/java/scatours/HelpPagesLauncher.java
+++ b/sandbox/travelsample/launchers/help-pages/src/main/java/scatours/HelpPagesLauncher.java
@@ -28,11 +28,9 @@ import org.apache.tuscany.sca.node.SCANodeFactory;
public class HelpPagesLauncher {
public static void main(String[] args) throws Exception {
- SCAContribution helpContribution =
- locate("help-pages");
+ SCAContribution helpContribution = locate("help-pages");
- SCANode node = SCANodeFactory.newInstance().createSCANode(
- "help-pages.composite", helpContribution);
+ SCANode node = SCANodeFactory.newInstance().createSCANode("help-pages.composite", helpContribution);
node.start();
System.out.println("Node started - Press enter to shutdown.");
diff --git a/sandbox/travelsample/launchers/interaction/src/main/java/scatours/InteractionLauncher.java b/sandbox/travelsample/launchers/interaction/src/main/java/scatours/InteractionLauncher.java
index 93f6f435ee..292b10aaf0 100644
--- a/sandbox/travelsample/launchers/interaction/src/main/java/scatours/InteractionLauncher.java
+++ b/sandbox/travelsample/launchers/interaction/src/main/java/scatours/InteractionLauncher.java
@@ -28,41 +28,47 @@ import org.apache.tuscany.sca.node.SCANodeFactory;
public class InteractionLauncher {
public static void main(String[] args) throws Exception {
- SCANode node1 = SCANodeFactory.newInstance().createSCANode("client.composite",
- locate("common"),
- locate("currency"),
- locate("calendar"),
- locate("shoppingcart"),
- locate("interaction-client"));
-
- SCANode node2 = SCANodeFactory.newInstance().createSCANode("service.composite",
- locate("common"),
- locate("hotel"),
- locate("flight"),
- locate("interaction-service-remote"));
+ SCANode node1 =
+ SCANodeFactory.newInstance().createSCANode("client.composite",
+ locate("common"),
+ locate("currency"),
+ locate("calendar"),
+ locate("shoppingcart"),
+ locate("interaction-client"));
- node2.start();
+ SCANode node2 =
+ SCANodeFactory.newInstance().createSCANode("service.composite",
+ locate("common"),
+ locate("hotel"),
+ locate("flight"),
+ locate("interaction-service-remote"));
+
+ node2.start();
node1.start();
-
+
Runnable localInteraction = ((SCAClient)node1).getService(Runnable.class, "InteractionLocalClient/Runnable");
localInteraction.run();
-
+
Runnable remoteInteraction = ((SCAClient)node1).getService(Runnable.class, "InteractionRemoteClient/Runnable");
- remoteInteraction.run();
-
- Runnable requestResponseInteraction = ((SCAClient)node1).getService(Runnable.class, "InteractionRequestResponseClient/Runnable");
+ remoteInteraction.run();
+
+ Runnable requestResponseInteraction =
+ ((SCAClient)node1).getService(Runnable.class, "InteractionRequestResponseClient/Runnable");
requestResponseInteraction.run();
-
- Runnable onewayCallbackInteraction = ((SCAClient)node1).getService(Runnable.class, "InteractionOneWayCallbackClient/Runnable");
+
+ Runnable onewayCallbackInteraction =
+ ((SCAClient)node1).getService(Runnable.class, "InteractionOneWayCallbackClient/Runnable");
onewayCallbackInteraction.run();
-
- Runnable conversationalInteraction = ((SCAClient)node1).getService(Runnable.class, "InteractionConversationClient/Runnable");
+
+ Runnable conversationalInteraction =
+ ((SCAClient)node1).getService(Runnable.class, "InteractionConversationClient/Runnable");
conversationalInteraction.run();
-
- Runnable statefulCallbackInteraction = ((SCAClient)node1).getService(Runnable.class, "InteractionStatefulCallbackClient/Runnable");
- statefulCallbackInteraction.run();
-
+
+ Runnable statefulCallbackInteraction =
+ ((SCAClient)node1).getService(Runnable.class, "InteractionStatefulCallbackClient/Runnable");
+ statefulCallbackInteraction.run();
+
node1.stop();
node2.stop();
- }
+ }
}
diff --git a/sandbox/travelsample/launchers/interaction/src/test/java/scatours/InteractionTestCase.java b/sandbox/travelsample/launchers/interaction/src/test/java/scatours/InteractionTestCase.java
index c674cdcd75..c64e5d1e5b 100644
--- a/sandbox/travelsample/launchers/interaction/src/test/java/scatours/InteractionTestCase.java
+++ b/sandbox/travelsample/launchers/interaction/src/test/java/scatours/InteractionTestCase.java
@@ -35,7 +35,7 @@ public class InteractionTestCase {
public void testLauncher() throws Exception {
InteractionLauncher.main(null);
}
-
+
@After
public void stopServer() throws Exception {
}
diff --git a/sandbox/travelsample/launchers/introducing-client/src/main/java/scatours/IntroducingClientLauncher.java b/sandbox/travelsample/launchers/introducing-client/src/main/java/scatours/IntroducingClientLauncher.java
index b45a14cd9c..f261ef6e27 100644
--- a/sandbox/travelsample/launchers/introducing-client/src/main/java/scatours/IntroducingClientLauncher.java
+++ b/sandbox/travelsample/launchers/introducing-client/src/main/java/scatours/IntroducingClientLauncher.java
@@ -26,12 +26,13 @@ import org.apache.tuscany.sca.node.SCANodeFactory;
public class IntroducingClientLauncher {
public static void main(String[] args) throws Exception {
- SCANode node = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/ClientNode");
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/ClientNode");
node.start();
Runnable client = ((SCAClient)node).getService(Runnable.class, "TestClient/Runnable");
client.run();
-
+
node.stop();
}
}
diff --git a/sandbox/travelsample/launchers/introducing/src/main/java/scatours/IntroducingLauncher.java b/sandbox/travelsample/launchers/introducing/src/main/java/scatours/IntroducingLauncher.java
index bef43d9c7a..4ad19762d9 100644
--- a/sandbox/travelsample/launchers/introducing/src/main/java/scatours/IntroducingLauncher.java
+++ b/sandbox/travelsample/launchers/introducing/src/main/java/scatours/IntroducingLauncher.java
@@ -28,16 +28,17 @@ import org.apache.tuscany.sca.node.SCANodeFactory;
public class IntroducingLauncher {
public static void main(String[] args) throws Exception {
- SCANode node = SCANodeFactory.newInstance().createSCANode(null,
- locate("introducing-tours"),
- locate("introducing-trips"),
- locate("introducing-client"));
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode(null,
+ locate("introducing-tours"),
+ locate("introducing-trips"),
+ locate("introducing-client"));
node.start();
Runnable proxy = ((SCAClient)node).getService(Runnable.class, "TestClient/Runnable");
proxy.run();
-
+
node.stop();
}
}
diff --git a/sandbox/travelsample/launchers/introducing/src/test/java/scatours/IntroducingTestCase.java b/sandbox/travelsample/launchers/introducing/src/test/java/scatours/IntroducingTestCase.java
index e31e8e70ab..573d2e76bd 100644
--- a/sandbox/travelsample/launchers/introducing/src/test/java/scatours/IntroducingTestCase.java
+++ b/sandbox/travelsample/launchers/introducing/src/test/java/scatours/IntroducingTestCase.java
@@ -37,10 +37,15 @@ public class IntroducingTestCase {
@Before
public void startServer() throws Exception {
- node = SCANodeFactory.newInstance().createSCANode(null,
- new SCAContribution("introducing-tours", "../../contributions/introducing-tours/target/classes"),
- new SCAContribution("introducing-trips", "../../contributions/introducing-trips/target/classes"),
- new SCAContribution("introducing-client", "../../contributions/introducing-client/target/classes"));
+ node =
+ SCANodeFactory.newInstance()
+ .createSCANode(null,
+ new SCAContribution("introducing-tours",
+ "../../contributions/introducing-tours/target/classes"),
+ new SCAContribution("introducing-trips",
+ "../../contributions/introducing-trips/target/classes"),
+ new SCAContribution("introducing-client",
+ "../../contributions/introducing-client/target/classes"));
node.start();
}
diff --git a/sandbox/travelsample/launchers/jumpstart/src/main/java/scatours/JumpstartLauncher.java b/sandbox/travelsample/launchers/jumpstart/src/main/java/scatours/JumpstartLauncher.java
index 8c6f19f1db..544043884b 100644
--- a/sandbox/travelsample/launchers/jumpstart/src/main/java/scatours/JumpstartLauncher.java
+++ b/sandbox/travelsample/launchers/jumpstart/src/main/java/scatours/JumpstartLauncher.java
@@ -29,20 +29,15 @@ import org.apache.tuscany.sca.node.SCANodeFactory;
public class JumpstartLauncher {
public static void main(String[] args) throws Exception {
- SCAContribution gvtContribution =
- locate("introducing-trips");
-
- SCANode node = SCANodeFactory.newInstance().
- createSCANode("trips.composite",
- gvtContribution);
-
+ SCAContribution gvtContribution = locate("introducing-trips");
+
+ SCANode node = SCANodeFactory.newInstance().createSCANode("trips.composite", gvtContribution);
+
node.start();
- Trips tripProvider = ((SCAClient)node).getService(Trips.class,
- "TripProvider/Trips");
-
- System.out.println("Trip boooking code = " +
- tripProvider.checkAvailability("FS1APR4", 2));
+ Trips tripProvider = ((SCAClient)node).getService(Trips.class, "TripProvider/Trips");
+
+ System.out.println("Trip boooking code = " + tripProvider.checkAvailability("FS1APR4", 2));
node.stop();
}
diff --git a/sandbox/travelsample/launchers/jumpstart/src/test/java/scatours/JumpstartTestCase.java b/sandbox/travelsample/launchers/jumpstart/src/test/java/scatours/JumpstartTestCase.java
index 5ed8942168..4da7c54917 100644
--- a/sandbox/travelsample/launchers/jumpstart/src/test/java/scatours/JumpstartTestCase.java
+++ b/sandbox/travelsample/launchers/jumpstart/src/test/java/scatours/JumpstartTestCase.java
@@ -35,16 +35,18 @@ public class JumpstartTestCase {
@Before
public void startServer() throws Exception {
- node = SCANodeFactory.newInstance().createSCANode("trips.composite",
- new SCAContribution("introducing-trips", "../../contributions/introducing-trips/target/classes"));
+ node =
+ SCANodeFactory.newInstance()
+ .createSCANode("trips.composite",
+ new SCAContribution("introducing-trips",
+ "../../contributions/introducing-trips/target/classes"));
node.start();
}
@Test
public void testClient() throws Exception {
Trips tripProvider = ((SCAClient)node).getService(Trips.class, "TripProvider/Trips");
- System.out.println("Trip boooking code = " +
- tripProvider.checkAvailability("FS1APR4", 2));
+ System.out.println("Trip boooking code = " + tripProvider.checkAvailability("FS1APR4", 2));
}
@After
diff --git a/sandbox/travelsample/launchers/notification-corba/src/main/java/scatours/NotificationCORBALauncher.java b/sandbox/travelsample/launchers/notification-corba/src/main/java/scatours/NotificationCORBALauncher.java
index eb7d12f2f9..44b94b3a59 100644
--- a/sandbox/travelsample/launchers/notification-corba/src/main/java/scatours/NotificationCORBALauncher.java
+++ b/sandbox/travelsample/launchers/notification-corba/src/main/java/scatours/NotificationCORBALauncher.java
@@ -31,18 +31,17 @@ import scatours.notification.Notification;
public class NotificationCORBALauncher {
public static void main(String[] args) throws Exception {
- SCAContribution notificationContribution =
- locate("notification");
- SCAContribution notificationCORBAContribution =
- locate("notification-corba");
+ SCAContribution notificationContribution = locate("notification");
+ SCAContribution notificationCORBAContribution = locate("notification-corba");
- SCANode node = SCANodeFactory.newInstance().createSCANode(
- "notification-corba.composite", notificationContribution, notificationCORBAContribution);
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("notification-corba.composite",
+ notificationContribution,
+ notificationCORBAContribution);
node.start();
System.out.println("Quick notification test");
- Notification notification = ((SCAClient)node).getService(
- Notification.class, "Notification");
+ Notification notification = ((SCAClient)node).getService(Notification.class, "Notification");
String accountID = "1234";
String subject = "Holiday payment taken";
String message = "Payment of £102.37 accepted...";
diff --git a/sandbox/travelsample/launchers/notification-corba/src/main/java/scatours/notification/Notification.java b/sandbox/travelsample/launchers/notification-corba/src/main/java/scatours/notification/Notification.java
index 79706fcc9d..020e1e40db 100644
--- a/sandbox/travelsample/launchers/notification-corba/src/main/java/scatours/notification/Notification.java
+++ b/sandbox/travelsample/launchers/notification-corba/src/main/java/scatours/notification/Notification.java
@@ -20,7 +20,7 @@
package scatours.notification;
public interface Notification {
-
- boolean notify(String accountID, String subject, String message);
+
+ boolean notify(String accountID, String subject, String message);
}
diff --git a/sandbox/travelsample/launchers/notification-ejb/src/main/java/scatours/NotificationEJBLauncher.java b/sandbox/travelsample/launchers/notification-ejb/src/main/java/scatours/NotificationEJBLauncher.java
index 880908a7a7..2d843e9ff9 100644
--- a/sandbox/travelsample/launchers/notification-ejb/src/main/java/scatours/NotificationEJBLauncher.java
+++ b/sandbox/travelsample/launchers/notification-ejb/src/main/java/scatours/NotificationEJBLauncher.java
@@ -36,18 +36,17 @@ public class NotificationEJBLauncher {
System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
System.setProperty(Context.PROVIDER_URL, "ejbd://localhost:4201");
- SCAContribution notificationContribution =
- locate("notification");
- SCAContribution notificationEJBContribution =
- locate("notification-ejb");
+ SCAContribution notificationContribution = locate("notification");
+ SCAContribution notificationEJBContribution = locate("notification-ejb");
- SCANode node = SCANodeFactory.newInstance().createSCANode(
- "notification-ejb.composite", notificationContribution, notificationEJBContribution);
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("notification-ejb.composite",
+ notificationContribution,
+ notificationEJBContribution);
node.start();
System.out.println("Quick notification test");
- Notification notification = ((SCAClient)node).getService(
- Notification.class, "Notification");
+ Notification notification = ((SCAClient)node).getService(Notification.class, "Notification");
String accountID = "1234";
String subject = "Holiday payment taken";
String message = "Payment of £102.37 accepted...";
diff --git a/sandbox/travelsample/launchers/notification-ejb/src/main/java/scatours/notification/Notification.java b/sandbox/travelsample/launchers/notification-ejb/src/main/java/scatours/notification/Notification.java
index 79706fcc9d..020e1e40db 100644
--- a/sandbox/travelsample/launchers/notification-ejb/src/main/java/scatours/notification/Notification.java
+++ b/sandbox/travelsample/launchers/notification-ejb/src/main/java/scatours/notification/Notification.java
@@ -20,7 +20,7 @@
package scatours.notification;
public interface Notification {
-
- boolean notify(String accountID, String subject, String message);
+
+ boolean notify(String accountID, String subject, String message);
}
diff --git a/sandbox/travelsample/launchers/notification-jms/src/main/java/scatours/JMSBrokerLauncher.java b/sandbox/travelsample/launchers/notification-jms/src/main/java/scatours/JMSBrokerLauncher.java
index 7d063ca865..929eb78431 100644
--- a/sandbox/travelsample/launchers/notification-jms/src/main/java/scatours/JMSBrokerLauncher.java
+++ b/sandbox/travelsample/launchers/notification-jms/src/main/java/scatours/JMSBrokerLauncher.java
@@ -23,16 +23,16 @@ import org.apache.activemq.broker.BrokerService;
public class JMSBrokerLauncher {
public static void main(String[] args) throws Exception {
- final BrokerService jmsBroker = new BrokerService();
- jmsBroker.setPersistent(false);
- jmsBroker.setUseJmx(false);
- jmsBroker.addConnector("tcp://localhost:61619");
- jmsBroker.start();
+ final BrokerService jmsBroker = new BrokerService();
+ jmsBroker.setPersistent(false);
+ jmsBroker.setUseJmx(false);
+ jmsBroker.addConnector("tcp://localhost:61619");
+ jmsBroker.start();
- System.out.println("JMS Message Broker started");
- System.out.println("Press enter to shutdown.");
- System.in.read();
+ System.out.println("JMS Message Broker started");
+ System.out.println("Press enter to shutdown.");
+ System.in.read();
- jmsBroker.stop();
+ jmsBroker.stop();
}
- }
+}
diff --git a/sandbox/travelsample/launchers/notification-jms/src/main/java/scatours/NotificationJMSLauncher.java b/sandbox/travelsample/launchers/notification-jms/src/main/java/scatours/NotificationJMSLauncher.java
index c6ee50e2e8..c2ffda0725 100644
--- a/sandbox/travelsample/launchers/notification-jms/src/main/java/scatours/NotificationJMSLauncher.java
+++ b/sandbox/travelsample/launchers/notification-jms/src/main/java/scatours/NotificationJMSLauncher.java
@@ -31,20 +31,19 @@ import scatours.notification.Notification;
public class NotificationJMSLauncher {
public static void main(String[] args) throws Exception {
- SCAContribution notificationContribution =
- locate("notification");
- SCAContribution notificationJMSContribution =
- locate("notification-jms");
+ SCAContribution notificationContribution = locate("notification");
+ SCAContribution notificationJMSContribution = locate("notification-jms");
- SCANode node = SCANodeFactory.newInstance().createSCANode(
- "notification-jms.composite", notificationContribution, notificationJMSContribution);
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("notification-jms.composite",
+ notificationContribution,
+ notificationJMSContribution);
try {
node.start();
-
+
System.out.println("Quick notification test");
- Notification notification = ((SCAClient)node).getService(
- Notification.class, "Notification");
+ Notification notification = ((SCAClient)node).getService(Notification.class, "Notification");
String accountID = "1234";
String subject = "Holiday payment taken";
String message = "Payment of £102.37 accepted...";
diff --git a/sandbox/travelsample/launchers/notification-jms/src/main/java/scatours/notification/Notification.java b/sandbox/travelsample/launchers/notification-jms/src/main/java/scatours/notification/Notification.java
index 79706fcc9d..020e1e40db 100644
--- a/sandbox/travelsample/launchers/notification-jms/src/main/java/scatours/notification/Notification.java
+++ b/sandbox/travelsample/launchers/notification-jms/src/main/java/scatours/notification/Notification.java
@@ -20,7 +20,7 @@
package scatours.notification;
public interface Notification {
-
- boolean notify(String accountID, String subject, String message);
+
+ boolean notify(String accountID, String subject, String message);
}
diff --git a/sandbox/travelsample/launchers/notification-rmi/src/main/java/scatours/NotificationRMILauncher.java b/sandbox/travelsample/launchers/notification-rmi/src/main/java/scatours/NotificationRMILauncher.java
index 200f870417..2904349a49 100644
--- a/sandbox/travelsample/launchers/notification-rmi/src/main/java/scatours/NotificationRMILauncher.java
+++ b/sandbox/travelsample/launchers/notification-rmi/src/main/java/scatours/NotificationRMILauncher.java
@@ -31,18 +31,17 @@ import scatours.notification.Notification;
public class NotificationRMILauncher {
public static void main(String[] args) throws Exception {
- SCAContribution notificationContribution =
- locate("notification");
- SCAContribution notificationRMIContribution =
- locate("notification-rmi");
+ SCAContribution notificationContribution = locate("notification");
+ SCAContribution notificationRMIContribution = locate("notification-rmi");
- SCANode node = SCANodeFactory.newInstance().createSCANode(
- "notification-rmi.composite", notificationContribution, notificationRMIContribution);
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("notification-rmi.composite",
+ notificationContribution,
+ notificationRMIContribution);
node.start();
System.out.println("Quick notification test");
- Notification notification = ((SCAClient)node).getService(
- Notification.class, "Notification");
+ Notification notification = ((SCAClient)node).getService(Notification.class, "Notification");
String accountID = "1234";
String subject = "Holiday payment taken";
String message = "Payment of £102.37 accepted...";
diff --git a/sandbox/travelsample/launchers/notification-rmi/src/main/java/scatours/notification/Notification.java b/sandbox/travelsample/launchers/notification-rmi/src/main/java/scatours/notification/Notification.java
index 79706fcc9d..020e1e40db 100644
--- a/sandbox/travelsample/launchers/notification-rmi/src/main/java/scatours/notification/Notification.java
+++ b/sandbox/travelsample/launchers/notification-rmi/src/main/java/scatours/notification/Notification.java
@@ -20,7 +20,7 @@
package scatours.notification;
public interface Notification {
-
- boolean notify(String accountID, String subject, String message);
+
+ boolean notify(String accountID, String subject, String message);
}
diff --git a/sandbox/travelsample/launchers/notification-ws/src/main/java/scatours/NotificationWSLauncher.java b/sandbox/travelsample/launchers/notification-ws/src/main/java/scatours/NotificationWSLauncher.java
index 4d7f1741fe..fbdb1500f5 100644
--- a/sandbox/travelsample/launchers/notification-ws/src/main/java/scatours/NotificationWSLauncher.java
+++ b/sandbox/travelsample/launchers/notification-ws/src/main/java/scatours/NotificationWSLauncher.java
@@ -31,18 +31,17 @@ import scatours.notification.Notification;
public class NotificationWSLauncher {
public static void main(String[] args) throws Exception {
- SCAContribution notificationContribution =
- locate("notification");
- SCAContribution notificationWSContribution =
- locate("notification-ws");
+ SCAContribution notificationContribution = locate("notification");
+ SCAContribution notificationWSContribution = locate("notification-ws");
- SCANode node = SCANodeFactory.newInstance().createSCANode(
- "notification-ws.composite", notificationContribution, notificationWSContribution);
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("notification-ws.composite",
+ notificationContribution,
+ notificationWSContribution);
node.start();
System.out.println("Quick notification test");
- Notification notification = ((SCAClient)node).getService(
- Notification.class, "Notification");
+ Notification notification = ((SCAClient)node).getService(Notification.class, "Notification");
String accountID = "1234";
String subject = "Holiday payment taken";
String message = "Payment of £102.37 accepted...";
diff --git a/sandbox/travelsample/launchers/notification-ws/src/main/java/scatours/notification/Notification.java b/sandbox/travelsample/launchers/notification-ws/src/main/java/scatours/notification/Notification.java
index 79706fcc9d..020e1e40db 100644
--- a/sandbox/travelsample/launchers/notification-ws/src/main/java/scatours/notification/Notification.java
+++ b/sandbox/travelsample/launchers/notification-ws/src/main/java/scatours/notification/Notification.java
@@ -20,7 +20,7 @@
package scatours.notification;
public interface Notification {
-
- boolean notify(String accountID, String subject, String message);
+
+ boolean notify(String accountID, String subject, String message);
}
diff --git a/sandbox/travelsample/launchers/policy/src/main/java/scatours/PolicyLauncher.java b/sandbox/travelsample/launchers/policy/src/main/java/scatours/PolicyLauncher.java
index 838b9d93e5..4e16b9c072 100644
--- a/sandbox/travelsample/launchers/policy/src/main/java/scatours/PolicyLauncher.java
+++ b/sandbox/travelsample/launchers/policy/src/main/java/scatours/PolicyLauncher.java
@@ -28,20 +28,17 @@ import org.apache.tuscany.sca.node.SCANodeFactory;
public class PolicyLauncher {
public static void main(String[] args) throws Exception {
- SCANode node1 = SCANodeFactory.newInstance().createSCANode(null,
- locate("client"),
- locate("payment"));
+ SCANode node1 = SCANodeFactory.newInstance().createSCANode(null, locate("client"), locate("payment"));
node1.start();
-
- SCANode node2 = SCANodeFactory.newInstance().createSCANode(null,
- locate("creditcard"));
-
+
+ SCANode node2 = SCANodeFactory.newInstance().createSCANode(null, locate("creditcard"));
+
node2.start();
-
+
Runnable client = ((SCAClient)node1).getService(Runnable.class, "TestClient/Runnable");
client.run();
-
+
node1.stop();
node2.stop();
}
diff --git a/sandbox/travelsample/services/creditcard-payment-jaxws/src/main/java/scatours/creditcard/CreditCardServiceImpl.java b/sandbox/travelsample/services/creditcard-payment-jaxws/src/main/java/scatours/creditcard/CreditCardServiceImpl.java
index aeb0632ed4..7118edbc1f 100644
--- a/sandbox/travelsample/services/creditcard-payment-jaxws/src/main/java/scatours/creditcard/CreditCardServiceImpl.java
+++ b/sandbox/travelsample/services/creditcard-payment-jaxws/src/main/java/scatours/creditcard/CreditCardServiceImpl.java
@@ -20,13 +20,12 @@ package scatours.creditcard;
import javax.jws.WebService;
-@WebService(endpointInterface
- = "scatours.creditcard.CreditCardService")
+@WebService(endpointInterface = "scatours.creditcard.CreditCardService")
public class CreditCardServiceImpl implements CreditCardService {
public String makePayment(String cardNumber, String name, double amount) {
System.out.println("Payment request from " + name);
-
+
if (cardNumber != null && cardNumber.startsWith("1")) {
return "AUTH_ID:" + System.currentTimeMillis();
}
diff --git a/sandbox/travelsample/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayCORBAServiceBootstrap.java b/sandbox/travelsample/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayCORBAServiceBootstrap.java
index b21bff7a1b..3ea7f7de44 100644
--- a/sandbox/travelsample/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayCORBAServiceBootstrap.java
+++ b/sandbox/travelsample/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayCORBAServiceBootstrap.java
@@ -30,30 +30,30 @@ public class SMSGatewayCORBAServiceBootstrap {
public static void main(String[] args) throws Exception {
System.out.println("Publishing SMS Gateway Service as a CORBA service: SMSGatewayCORBAService (port=5080)");
-
+
String[] orbArgs = {"-ORBInitialPort", "5080"};
- ORB orb = ORB.init( orbArgs, null );
+ ORB orb = ORB.init(orbArgs, null);
NamingContextExt namingCtx;
try {
- Object objRef = orb.resolve_initial_references("NameService");
- namingCtx = NamingContextExtHelper.narrow(objRef);
+ Object objRef = orb.resolve_initial_references("NameService");
+ namingCtx = NamingContextExtHelper.narrow(objRef);
} catch (Exception ex) {
- System.err.println("ERROR: Failed to resolve Name Service.");
- System.err.println("Don't forget to run it with:");
- System.err.println(" tnameserv -ORBInitialPort 5080");
- return;
+ System.err.println("ERROR: Failed to resolve Name Service.");
+ System.err.println("Don't forget to run it with:");
+ System.err.println(" tnameserv -ORBInitialPort 5080");
+ return;
}
Object rootPoaRef = orb.resolve_initial_references("RootPOA");
POA rootPoa = POAHelper.narrow(rootPoaRef);
rootPoa.the_POAManager().activate();
-
+
SMSGatewayServant smsGateway = new SMSGatewayServant();
Object smsGatewayRef = rootPoa.servant_to_reference(smsGateway);
String corbaServerName = "SMSGatewayCORBAService";
- NameComponent[] name = { new NameComponent(corbaServerName, "") };
+ NameComponent[] name = {new NameComponent(corbaServerName, "")};
namingCtx.rebind(name, smsGatewayRef);
System.out.println("CORBA server running - waiting for requests");
diff --git a/sandbox/travelsample/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayServant.java b/sandbox/travelsample/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayServant.java
index 5e43b671a0..693a909dca 100644
--- a/sandbox/travelsample/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayServant.java
+++ b/sandbox/travelsample/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayServant.java
@@ -18,7 +18,6 @@
*/
package scatours.smsgateway;
-
public class SMSGatewayServant extends SMSGatewayPOA {
public boolean sendSMS(String fromNumber, String toNumber, String text) {
diff --git a/sandbox/travelsample/services/smsgateway-ejb/src/main/java/scatours/smsgateway/SMSGatewayEJBServiceBootstrap.java b/sandbox/travelsample/services/smsgateway-ejb/src/main/java/scatours/smsgateway/SMSGatewayEJBServiceBootstrap.java
index b807a53130..5c1a61f4dc 100644
--- a/sandbox/travelsample/services/smsgateway-ejb/src/main/java/scatours/smsgateway/SMSGatewayEJBServiceBootstrap.java
+++ b/sandbox/travelsample/services/smsgateway-ejb/src/main/java/scatours/smsgateway/SMSGatewayEJBServiceBootstrap.java
@@ -26,20 +26,20 @@ import javax.naming.InitialContext;
public class SMSGatewayEJBServiceBootstrap {
public static void main(String[] args) throws Exception {
- System.out.println("Publishing SMS Gateway Service as an EJB service");
+ System.out.println("Publishing SMS Gateway Service as an EJB service");
- Properties properties = new Properties();
- properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
- properties.setProperty("openejb.embedded.remotable", "true");
+ Properties properties = new Properties();
+ properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
+ properties.setProperty("openejb.embedded.remotable", "true");
- InitialContext initialContext = new InitialContext(properties);
+ InitialContext initialContext = new InitialContext(properties);
-// Object object = initialContext.lookup("SMSGatewayImplRemote");
-// SMSGateway smsGateway = (SMSGateway) object;
-// smsGateway.sendSMS("From", "to", "Message");
+ // Object object = initialContext.lookup("SMSGatewayImplRemote");
+ // SMSGateway smsGateway = (SMSGateway) object;
+ // smsGateway.sendSMS("From", "to", "Message");
- System.out.println("EJB server running - waiting for requests");
- System.out.println("Press enter to shutdown.");
- System.in.read();
+ System.out.println("EJB server running - waiting for requests");
+ System.out.println("Press enter to shutdown.");
+ System.in.read();
}
}
diff --git a/sandbox/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGateway.java b/sandbox/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGateway.java
index a900dfecee..e6e866fa1d 100644
--- a/sandbox/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGateway.java
+++ b/sandbox/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGateway.java
@@ -22,7 +22,6 @@ package scatours.smsgateway;
import java.rmi.Remote;
import java.rmi.RemoteException;
-
/**
* A gateway to send SMS messages.
*/
diff --git a/sandbox/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayImpl.java b/sandbox/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayImpl.java
index adacac77f5..c35aa61513 100644
--- a/sandbox/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayImpl.java
+++ b/sandbox/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayImpl.java
@@ -44,83 +44,83 @@ public class SMSGatewayImpl implements SMSGateway {
private final MessageProducer producer;
public SMSGatewayImpl(Session session) throws JMSException {
- this.session = session;
- Destination requestDest = session.createQueue("SMSRequestQueue");
- consumer = session.createConsumer(requestDest);
+ this.session = session;
+ Destination requestDest = session.createQueue("SMSRequestQueue");
+ consumer = session.createConsumer(requestDest);
- Destination responseDest = session.createQueue("SMSResponseQueue");
- producer = session.createProducer(responseDest);
+ Destination responseDest = session.createQueue("SMSResponseQueue");
+ producer = session.createProducer(responseDest);
}
public void start() throws JMSException, XMLStreamException {
- while (true) {
- Message message = consumer.receive();
- handleRequest(message);
- }
+ while (true) {
+ Message message = consumer.receive();
+ handleRequest(message);
+ }
}
private void handleRequest(Message inMessage) throws XMLStreamException, JMSException {
- OMElement xml = parseXMLPayload(inMessage);
+ OMElement xml = parseXMLPayload(inMessage);
- String fromNumber = getStringArg(xml, 0);
- String toNumber = getStringArg(xml, 1);
- String text = getStringArg(xml, 2);
+ String fromNumber = getStringArg(xml, 0);
+ String toNumber = getStringArg(xml, 1);
+ String text = getStringArg(xml, 2);
- boolean result = sendSMS(fromNumber, toNumber, text);
+ boolean result = sendSMS(fromNumber, toNumber, text);
- String responseXML = createXMLResponse(result);
+ String responseXML = createXMLResponse(result);
- TextMessage outMessage = createResponseMessage(inMessage.getJMSMessageID(), responseXML);
- producer.send(outMessage);
+ TextMessage outMessage = createResponseMessage(inMessage.getJMSMessageID(), responseXML);
+ producer.send(outMessage);
}
private OMElement parseXMLPayload(Message inMessage) throws JMSException, XMLStreamException {
- final byte[] msgData;
- if (inMessage instanceof TextMessage) {
- msgData = ((TextMessage) inMessage).getText().getBytes();
- } else if (inMessage instanceof BytesMessage) {
- BytesMessage bytesMessage = (BytesMessage) inMessage;
- msgData = new byte[(int) bytesMessage.getBodyLength()];
- bytesMessage.readBytes(msgData);
- } else {
- throw new JMSException("Unsupported JMS message type of " + inMessage.getClass().getName());
- }
- ByteArrayInputStream in = new ByteArrayInputStream(msgData);
- StAXOMBuilder builder = new StAXOMBuilder(in);
- OMElement doc = builder.getDocumentElement();
- return doc;
+ final byte[] msgData;
+ if (inMessage instanceof TextMessage) {
+ msgData = ((TextMessage)inMessage).getText().getBytes();
+ } else if (inMessage instanceof BytesMessage) {
+ BytesMessage bytesMessage = (BytesMessage)inMessage;
+ msgData = new byte[(int)bytesMessage.getBodyLength()];
+ bytesMessage.readBytes(msgData);
+ } else {
+ throw new JMSException("Unsupported JMS message type of " + inMessage.getClass().getName());
+ }
+ ByteArrayInputStream in = new ByteArrayInputStream(msgData);
+ StAXOMBuilder builder = new StAXOMBuilder(in);
+ OMElement doc = builder.getDocumentElement();
+ return doc;
}
private String getStringArg(OMElement doc, int i) {
- QName argQName = new QName("arg" + i);
- OMElement arg = doc.getFirstChildWithName(argQName);
- if (arg == null) {
- return null;
- }
- return arg.getText();
+ QName argQName = new QName("arg" + i);
+ OMElement arg = doc.getFirstChildWithName(argQName);
+ if (arg == null) {
+ return null;
+ }
+ return arg.getText();
}
public boolean sendSMS(String fromNumber, String toNumber, String text) {
- System.out.println("From: " + fromNumber);
- System.out.println("To: " + toNumber);
- System.out.println(text);
- return true;
+ System.out.println("From: " + fromNumber);
+ System.out.println("To: " + toNumber);
+ System.out.println(text);
+ return true;
}
private String createXMLResponse(boolean result) {
- OMFactory omFactory = OMAbstractFactory.getOMFactory();
- OMElement response = omFactory.createOMElement("sendSMS", "http://smsgateway.scatours/", "ns2");
- OMElement returnValue = omFactory.createOMElement("return", null);
- OMText returnV = omFactory.createOMText(Boolean.toString(result));
- returnValue.addChild(returnV);
- response.addChild(returnValue);
- return response.toString();
+ OMFactory omFactory = OMAbstractFactory.getOMFactory();
+ OMElement response = omFactory.createOMElement("sendSMS", "http://smsgateway.scatours/", "ns2");
+ OMElement returnValue = omFactory.createOMElement("return", null);
+ OMText returnV = omFactory.createOMText(Boolean.toString(result));
+ returnValue.addChild(returnV);
+ response.addChild(returnValue);
+ return response.toString();
}
private TextMessage createResponseMessage(String correlationID, String responseXML) throws JMSException {
- TextMessage outMessage = session.createTextMessage("sendSMS");
- outMessage.setText(responseXML);
- outMessage.setJMSCorrelationID(correlationID);
- return outMessage;
+ TextMessage outMessage = session.createTextMessage("sendSMS");
+ outMessage.setText(responseXML);
+ outMessage.setJMSCorrelationID(correlationID);
+ return outMessage;
}
- }
+}
diff --git a/sandbox/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayJMSServiceBootstrap.java b/sandbox/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayJMSServiceBootstrap.java
index 3e5668ed23..d27635f0c3 100644
--- a/sandbox/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayJMSServiceBootstrap.java
+++ b/sandbox/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayJMSServiceBootstrap.java
@@ -26,15 +26,14 @@ import org.apache.activemq.ActiveMQConnectionFactory;
public class SMSGatewayJMSServiceBootstrap {
public static void main(String[] args) throws Exception {
- System.out.println("Publishing SMS Gateway Service as a JMS service: tcp://localhost:61619");
+ System.out.println("Publishing SMS Gateway Service as a JMS service: tcp://localhost:61619");
- ActiveMQConnectionFactory connectionFactory
- = new ActiveMQConnectionFactory("tcp://localhost:61619");
- Connection connection = connectionFactory.createConnection();
- connection.start();
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61619");
+ Connection connection = connectionFactory.createConnection();
+ connection.start();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- SMSGatewayImpl impl = new SMSGatewayImpl(session);
- impl.start();
+ SMSGatewayImpl impl = new SMSGatewayImpl(session);
+ impl.start();
}
}
diff --git a/sandbox/travelsample/services/smsgateway-rmi/src/main/java/scatours/smsgateway/SMSGateway.java b/sandbox/travelsample/services/smsgateway-rmi/src/main/java/scatours/smsgateway/SMSGateway.java
index a900dfecee..e6e866fa1d 100644
--- a/sandbox/travelsample/services/smsgateway-rmi/src/main/java/scatours/smsgateway/SMSGateway.java
+++ b/sandbox/travelsample/services/smsgateway-rmi/src/main/java/scatours/smsgateway/SMSGateway.java
@@ -22,7 +22,6 @@ package scatours.smsgateway;
import java.rmi.Remote;
import java.rmi.RemoteException;
-
/**
* A gateway to send SMS messages.
*/
diff --git a/sandbox/travelsample/services/smsgateway-rmi/src/main/java/scatours/smsgateway/SMSGatewayRMIServiceBootstrap.java b/sandbox/travelsample/services/smsgateway-rmi/src/main/java/scatours/smsgateway/SMSGatewayRMIServiceBootstrap.java
index 2c4c96299e..b13f3d2aee 100644
--- a/sandbox/travelsample/services/smsgateway-rmi/src/main/java/scatours/smsgateway/SMSGatewayRMIServiceBootstrap.java
+++ b/sandbox/travelsample/services/smsgateway-rmi/src/main/java/scatours/smsgateway/SMSGatewayRMIServiceBootstrap.java
@@ -24,17 +24,17 @@ import java.rmi.registry.Registry;
public class SMSGatewayRMIServiceBootstrap {
public static void main(String[] args) throws Exception {
- System.out.println("Publishing SMS Gateway Service as a RMI service");
+ System.out.println("Publishing SMS Gateway Service as a RMI service");
- String serviceName = "SMSGatewayRMI";
- SMSGatewayImpl smsGatewayImpl = new SMSGatewayImpl();
- Registry rmiRegistry = LocateRegistry.createRegistry(8099);
- rmiRegistry.bind(serviceName, smsGatewayImpl);
+ String serviceName = "SMSGatewayRMI";
+ SMSGatewayImpl smsGatewayImpl = new SMSGatewayImpl();
+ Registry rmiRegistry = LocateRegistry.createRegistry(8099);
+ rmiRegistry.bind(serviceName, smsGatewayImpl);
- System.out.println("RMI server running - waiting for requests");
- System.out.println("Press enter to shutdown.");
- System.in.read();
- rmiRegistry.unbind(serviceName);
- System.exit(-1);
+ System.out.println("RMI server running - waiting for requests");
+ System.out.println("Press enter to shutdown.");
+ System.in.read();
+ rmiRegistry.unbind(serviceName);
+ System.exit(-1);
}
}